Objective c 世卫组织';s知道为什么4英寸的iOS模拟器视网膜会出现黑色区域吗?

Objective c 世卫组织';s知道为什么4英寸的iOS模拟器视网膜会出现黑色区域吗?,objective-c,Objective C,当我在3.5英寸的iOS模拟器视网膜上测试时,它工作得很好。 但当在视网膜4英寸时,它出现黑色区域,如下图所示 我不知道这个原因 你能给我一些建议吗 以下是AppDelegate.h&m #import <UIKit/UIKit.h> #import "MenuViewCon.h" @class TestViewCon; @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (s

当我在3.5英寸的iOS模拟器视网膜上测试时,它工作得很好。 但当在视网膜4英寸时,它出现黑色区域,如下图所示

我不知道这个原因

你能给我一些建议吗


以下是AppDelegate.h&m

#import <UIKit/UIKit.h>
#import "MenuViewCon.h"

@class TestViewCon;

@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) TestViewCon *viewController;

@end

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    // Override point for customization after application launch.
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        self.viewController = [[[TestViewCon alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];

    } else {
        self.viewController = [[[TestViewCon alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];
    }

    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}
#导入
#导入“MenuViewCon.h”
@类TestViewCon;
@接口AppDelegate:UIResponder
@属性(强,非原子)UIWindow*window;
@属性(强,非原子)TestViewCon*viewController;
@结束
-(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项
{
self.window=[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]边界]]自动释放];
//应用程序启动后自定义的覆盖点。
if([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPhone){
self.viewController=[[TestViewCon alloc]initWithNibName:@“viewController_iPhone”捆绑包:nil]autorelease];
}否则{
self.viewController=[[TestViewCon alloc]initWithNibName:@“viewController_iPad”捆绑包:nil]自动释放];
}
self.window.rootViewController=self.viewController;
[self.window makeKeyAndVisible];
返回YES;
}

接下来是TestViewCon.h&m

#import <Foundation/Foundation.h>
@interface TestViewCon : UIViewController
@end

#import "TestViewCon.h"    
@implementation TestViewCon {
}

- (void)viewDidLoad {
    UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 100)] autorelease];
    label.text = @"Retina 4 inch testing";
    [label sizeToFit];
    [self.view addSubview:label];
}
@end
#导入
@接口TestViewCon:UIViewController
@结束
#导入“TestViewCon.h”
@实现TestViewCon{
}
-(无效)viewDidLoad{
UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(100100100100)]自动释放];
label.text=@“视网膜4英寸测试”;
[标签尺寸合适];
[self.view addSubview:label];
}
@结束

这是因为您的应用程序运行的是letterboxed。
看起来,您的项目中不支持iPhone5

为此,您需要添加一个默认值-568h@2x.png将图像添加到项目中,并将其设置为iPhone 5的启动图像