判断设备是iPhone还是iPad,主要是用来做适配用,因为一个项目有时候可能需要做iPhone和iPad兼容,就需要做两个XIB,废话不多说,上CODE:
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[iPhone alloc] initWithNibName:@"iPhone" bundle:nil];
} else {
self.viewController = [[iPad alloc] initWithNibName:@"iPad" bundle:nil];
}