关于自适应iphone、ipad布局的代码
2017年11月10日
⁄ 综合
⁄ 共 877字 ⁄ 字号
小 中 大
-
刚看到一段代码,关于自适应iphone、ipad布局的,有点启发,记载一下
-
- (id)init
-
{
-
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
-
[super initWithNibName:@"MainView~ipad" bundle:nil];
-
} else {
-
[super initWithNibName:@"MainView" bundle:nil];
-
}
-
-
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(screenDidConnectNotification:) name: UIScreenDidConnectNotification object: nil];
-
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(screenDidDisconnectNotification:) name: UIScreenDidDisconnectNotification object: nil];
-
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(screenModeDidChangeNotification:) name: UIScreenModeDidChangeNotification object: nil];
-
-
return self;
-
}
-
-
- (id)initWithNibName:(NSString *)n bundle:(NSBundle *)b
-
{
-
return [self init];
-
}