iOS判断设备类型,并设置背景色
2012-08-13 10:50
295 查看
- (void)viewDidLoad {
[super
viewDidLoad];
UIColor *clr = nil;
if ([[UIDevice
currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPad) {
clr = [UIColor
colorWithRed:0.875
green:0.88
blue:0.91
alpha:1];
}else{
clr = [UIColor
groupTableViewBackgroundColor];
}
[[self
view ] setBackgroundColor:clr];
}
通过UIDevice类发送currentDevice方法,可以得到UIDevice对象,然后检查该对象的userInterfaceIdiom属性。UIUserInterfaceIdiomPad针对Ipad,UIUserInterfaceIdiomPhone针对iphone和ipod
touch
[super
viewDidLoad];
UIColor *clr = nil;
if ([[UIDevice
currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPad) {
clr = [UIColor
colorWithRed:0.875
green:0.88
blue:0.91
alpha:1];
}else{
clr = [UIColor
groupTableViewBackgroundColor];
}
[[self
view ] setBackgroundColor:clr];
}
通过UIDevice类发送currentDevice方法,可以得到UIDevice对象,然后检查该对象的userInterfaceIdiom属性。UIUserInterfaceIdiomPad针对Ipad,UIUserInterfaceIdiomPhone针对iphone和ipod
touch
相关文章推荐
- ios开发过程中 设备类型的判断 系统版本号的判断
- iOS中判断设备类型的方法
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- iOS判断判断设备类型信息
- 判断iOS设备具体的类型
- 判断iOS设备的PUSH通知设置状态(打开。。。/关闭)
- ios版本和设备类型的判断
- 如何判断ios设备类型
- iOS UIDevice设备信息,传感器设置,横竖屏判断操作,手机电池操作
- ios开发之--判断当前设备的类型
- iOS 设备类型和版本判断
- 如何判断ios设备类型
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- 如何判断IOS设备类型
- iOS 设备类型判断
- IOS代码判断设备类型
- ios设备类型判断
- 判断设备的类型ipad或者iphone,调用自带应用,禁止锁屏,设置icon上的数字
- ios判断当前设备类型
- iOS 判断设备类型