简体   繁体   中英

UIUserInterfaceIdiomPhone is for iPod touch too?

Sorry for stupid question, but I have not found a good answer anywhere.

if I check UIUserInterfaceIdiomPhone I get YES for both iPhone and iPod touch?

I mean:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    return YES;
}

returns YES for iPad only and portrait for both iPhone and iPod?

I developed an iPhone app, now I'm changing it to universal. It's almost done and I wouldn't like to change all my "if". (i don't have a real iPod touch to test it by myself).

Thanks, Max

是的,iPod touch就像iPhone一样。

This macro is made for mainly distinguish the screen size of iPad and iPhone or iPod.
As iPhone and iPod have same screen size thus are both in Phone category. So UIUserInterfaceIdiomPhone is YES for iPhone and iPod
and is NO for iPad.
For more you can read apple docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM