LeeBooL 2016-01-06 08:58 采纳率: 0%
浏览 1581
已结题

iOS app 模拟器图片显示不全

在跟着千峰的视频写一个angrybirds
但是自己太水,真的是一步一个坑,自己跳的可爽了,明明是视频怎么教我怎么写的但是,。。。。。

创建精灵,模拟器的大小明明是 480 * 320 我的图片也是 480 * 320但是就是显示不全

 //
//  LoadingScene.m
//  AngryBirds
//
//  Created by lee on 16/1/6.
//  Copyright © 2016年 ltybrp. All rights reserved.
//

#import "LoadingScene.h"

@implementation LoadingScene
+(id) scene{
    CCScene *sc = [CCScene node];
    LoadingScene *ls = [LoadingScene node];
    [sc addChild:ls];
    return sc;
}


-(id) init{

    self  =[ super init];
    if(self){
        CGSize winSize = [[CCDirector sharedDirector] winSize];
        CCSprite *sp = [CCSprite spriteWithFile:@"loading.png"];
        [sp setPosition:ccp(winSize.width/2.0f, winSize.height/2.0f)];
        printf("%f %f\n",winSize.width/2.0f, winSize.height/2.0f);

        [self addChild:sp];

    }
    return self;
}
@end

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    _window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
    _window.rootViewController = [[UIViewController alloc]init];
    _window.backgroundColor = [UIColor blackColor];
    // Override point for customization after application launch.

    if (![CCDirector setDirectorType:kCCDirectorTypeDisplayLink]) {
        [CCDirector setDirectorType:kCCDirectorTypeDefault];
        return NO;
    }
    CCDirector *director = [CCDirector sharedDirector];
    EAGLView *glView = [EAGLView viewWithFrame:self.window.bounds pixelFormat: kEAGLColorFormatRGB565 depthFormat:0];
    [director setOpenGLView:glView];
    [director setDeviceOrientation:kCCDeviceOrientationPortrait];
    [director setAnimationInterval:1.0f/60.0f];
    [director setDisplayFPS:YES];

    RootViewController *rvc = [[RootViewController alloc] init];
    [rvc setView:glView];
    [_window setRootViewController:rvc];
    [rvc release];

    [_window makeKeyAndVisible];

    //First scene
    CCScene *sc = [LoadingScene scene];
    [[CCDirector sharedDirector] runWithScene:sc];

    return YES;
}

(https://img-ask.csdn.net/upload/201601/06/1452070848_2723.png)

  • 写回答

1条回答 默认 最新

  • oyljerry 2016-01-06 14:36
    关注

    主要是可能进行了屏幕的拉伸等 最好用autolayout来控制

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分