uidevice

API to determine whether running on iPhone or iPad [duplicate]

冷暖自知 提交于 2019-11-27 02:07:34
This question already has an answer here: iOS detect if user is on an iPad 16 answers Is there an API for checking at runtime whether you are running on an iPhone or an iPad? One way I can think of would be to use: [[UIDevice currentDevice] model]; And detect the existence of the string @"iPad" - which seems a bit fragile. In the 3.2 SDK, I see that UIDevice also has a property which is really what I'm looking for, but doesn't work for pre-3.2 (obviously): [[UIDevice currentDevice] userInterfaceIdiom]; Are there other ways than checking for the existence of @"iPad" for a universal app? Andiih

iOS: Device orientation on load

我是研究僧i 提交于 2019-11-27 00:09:06
It seems that when my app loads, it does not know its current orientation: UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]; if (orientation == UIDeviceOrientationPortrait) { NSLog(@"portrait");// only works after a rotation, not on loading app } Once I rotate the device, I get a correct orientation, but when I load the app, without changing the orientation, it seems that using [[UIDevice currentDevice] orientation] doesn't know the current orientation. Is there another way to check this when I first load my app? groomsy EDIT: I mis-read your question. This will

Detecting iOS UIDevice orientation

隐身守侯 提交于 2019-11-26 21:38:55
I need to detect when the device is in portrait orientation so that I can fire off a special animation. But I do not want my view to autorotate. How do I override a view autorotating when the device is rotated to portrait? My app only needs to display it's view in landscape but it seems I need to support portrait also if I want to be able to detect a rotation to portrait. David M. Syzdek Try doing the following when the application loads or when your view loads: [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self

Detecting Color of iPhone/iPad/iPod touch?

廉价感情. 提交于 2019-11-26 11:48:36
Is there any way or hack to detect on what color (black / white) iPhone, iPad or iPod touch the iOS is installed? I want to load corresponding UI skins in case of Black or White devices. There's a private API to retrieve both the DeviceColor and the DeviceEnclosureColor . UIDevice *device = [UIDevice currentDevice]; SEL selector = NSSelectorFromString(@"deviceInfoForKey:"); if (![device respondsToSelector:selector]) { selector = NSSelectorFromString(@"_deviceInfoForKey:"); } if ([device respondsToSelector:selector]) { NSLog(@"DeviceColor: %@ DeviceEnclosureColor: %@", [device performSelector

How Do I detect the orientation of the device on iOS?

老子叫甜甜 提交于 2019-11-26 10:38:40
问题 I have a question on how to detect the device orientation on iOS. I don\'t need to receive change notifications, just the current orientation itself. This seems to be a rather simple question, but I haven\'t been able to wrap my head around it. Below is what I have done so far: UIDevice *myDevice = [UIDevice currentDevice] ; [myDevice beginGeneratingDeviceOrientationNotifications]; UIDeviceOrientation deviceOrientation = myDevice.orientation; BOOL isCurrentlyLandscapeView =

API to determine whether running on iPhone or iPad [duplicate]

雨燕双飞 提交于 2019-11-26 09:55:52
问题 This question already has an answer here: iOS detect if user is on an iPad 16 answers Is there an API for checking at runtime whether you are running on an iPhone or an iPad? One way I can think of would be to use: [[UIDevice currentDevice] model]; And detect the existence of the string @\"iPad\" - which seems a bit fragile. In the 3.2 SDK, I see that UIDevice also has a property which is really what I\'m looking for, but doesn\'t work for pre-3.2 (obviously): [[UIDevice currentDevice]

iOS: Device orientation on load

北城以北 提交于 2019-11-26 09:21:36
问题 It seems that when my app loads, it does not know its current orientation: UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]; if (orientation == UIDeviceOrientationPortrait) { NSLog(@\"portrait\");// only works after a rotation, not on loading app } Once I rotate the device, I get a correct orientation, but when I load the app, without changing the orientation, it seems that using [[UIDevice currentDevice] orientation] doesn\'t know the current orientation. Is there

Detecting iOS UIDevice orientation

。_饼干妹妹 提交于 2019-11-26 08:01:12
问题 I need to detect when the device is in portrait orientation so that I can fire off a special animation. But I do not want my view to autorotate. How do I override a view autorotating when the device is rotated to portrait? My app only needs to display it\'s view in landscape but it seems I need to support portrait also if I want to be able to detect a rotation to portrait. 回答1: Try doing the following when the application loads or when your view loads: [[UIDevice currentDevice]

UIDevice uniqueIdentifier deprecated - What to do now?

萝らか妹 提交于 2019-11-25 23:56:38
问题 It has just come to light that the UIDevice uniqueIdentifier property is deprecated in iOS 5 and unavailable in iOS 7 and above. No alternative method or property appears to be available or forthcoming. Many of our existing apps are tightly dependent on this property for uniquely identifying a particular device. How might we handle this problem going forward? The suggestion from the documentation in 2011-2012 was: Special Considerations Do not use the uniqueIdentifier property. To create a