UIDevice* thisDevice = [UIDevice currentDevice];
if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone)
{
}
else
{
}
說明:
UIDevice物件有個userInterfaceIdiom property,
@property(nonatomic,readonly) UIUserInterfaceIdiom userInterfaceIdiom
其值有以下2種:
typedef NS_ENUM(NSInteger, UIUserInterfaceIdiom) {
UIUserInterfaceIdiomPhone,
UIUserInterfaceIdiomPad,
};
沒有留言:
張貼留言