您的位置:首页 > 其它

判断用户的是iPhone还是iPad

2015-01-06 14:22 253 查看
在IOS3.2及以后的版本中, 可以使用UIKit中定义的函数UI_USER_INTERFACE_IDIOM来判断,
该函数返回两个值为UIUserInterfaceIdiomPhoneUIUserInterfaceIdiomPad.

为方便可在代码中定义isiPad来直接判断

code

UI_USER_INTERFACE_IDIOM

Returns the interface idiom supported by the current device.

code

Return Value

UIUserInterfaceIdiomPhone if the device is an iPhone or iPod touch or UIUserInterfaceIdiomPad if the device is an iPad.

Availability

Available in iOS 3.2 and later.

Declared In

UIDevice.

转载:http://www.xw.hb.cn/Html/Article/iPhone/iPhone-iPad-check.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: