Iphone UIUserInterfaceIdioPhone也适用于iPod touch?

Iphone UIUserInterfaceIdioPhone也适用于iPod touch?,iphone,ios,ipad,ipod-touch,Iphone,Ios,Ipad,Ipod Touch,很抱歉问了这么愚蠢的问题,但我还没有找到一个好的答案 如果我检查UIUserInterfaceIdiomPhone,我会得到iPhone和iPod touch的是 我的意思是: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInte

很抱歉问了这么愚蠢的问题,但我还没有找到一个好的答案

如果我检查UIUserInterfaceIdiomPhone,我会得到iPhone和iPod touch的是

我的意思是:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    return YES;
}
仅对iPad返回是,对iPhone和iPod返回肖像

我开发了一个iPhone应用程序,现在我要把它改成通用。差不多完成了,我不想改变我所有的“如果”。(我没有一个真正的iPodtouch可以自己测试)

谢谢,
Max

是的,iPod touch作为iPhone使用。

此宏主要用于区分iPad、iPhone或iPod的屏幕大小。
由于iPhone和iPod具有相同的屏幕尺寸,因此它们都属于手机类。 因此,iPhone和iPod的
UIUserInterfaceIdiomPhone
YES

对于iPad是
NO

更多你可以阅读