判断是不是iphone

记下来以后有用到,没有测试过,不知道能不能实现判断iPhone和iPad
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){

        NSLog(@"iPhone");
        
    } else {
        NSLog(@"iPad");
    }


if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
    } else {
        self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];
    }

你可能感兴趣的:(判断是不是iphone)