当我在 iOS 模拟器 Retina 3.5 英寸中进行测试时,它运行良好。但在 Retina 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;
}
接下来是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