Questions tagged [uidevice]

The UIDevice class provides a singleton instance representing the current device. From this instance you can obtain information about the device such as assigned name, device model, and operating-system name and version. Available in iOS 2.0 and later

UIDevice instance is used to detect changes in the device’s characteristics, such as physical orientation. You get the current orientation using the orientation property or receive change notifications by registering for the UIDeviceOrientationDidChangeNotification notification. Before using either of these techniques to get orientation data, you must enable data delivery using the beginGeneratingDeviceOrientationNotifications method.

When you no longer need to track the device orientation, call the endGeneratingDeviceOrientationNotifications method to disable the delivery of notifications.

Source: UIDevice Class reference

Related tag:

Related SO Questions:

167 questions
504
votes
32 answers

UIDevice uniqueIdentifier deprecated - What to do now?

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…
Oliver Pearmain
  • 17,376
  • 12
  • 77
  • 83
72
votes
8 answers

Detecting iOS UIDevice orientation

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…
Jace999
  • 721
  • 1
  • 6
  • 7
72
votes
6 answers

Detecting Color of iPhone/iPad/iPod touch?

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.
totocaster
  • 5,861
  • 5
  • 34
  • 46
72
votes
14 answers

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

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…
JusmanX
  • 751
  • 1
  • 7
  • 5
54
votes
16 answers

iOS: Device orientation on load

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…
Nic Hubbard
  • 39,231
  • 60
  • 236
  • 403
32
votes
5 answers

API to determine whether running on iPhone or iPad

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…
Eric
  • 3,795
  • 4
  • 28
  • 44
31
votes
8 answers

Know if iOS device has cellular data capabilities

I have a toggle in my app that's "download on WiFi only". However, that toggle is useless for iPod touch or WiFi-iPads. Is there a way to know if the device has cellular data capabilities in code? Something that would work in the future would be…
gcamp
  • 14,491
  • 4
  • 52
  • 81
20
votes
1 answer

UIDevice properties not working in static library

I have created a static library in Iphone SDK in which I used some UIDevice properties. When I run the app, this xcode show this error UIDevice Undeclared... Even the same code is running perfectly fine while I don't create static libraries and just…
Arsalan Haider
  • 559
  • 3
  • 8
  • 22
19
votes
3 answers

how to deal with UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown?

a noob question here. i detect the orientation with: UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]; all is fine and dandy and I reposition my text fields and labels according to the reported orientation with if…
EarlGrey
  • 2,359
  • 4
  • 31
  • 63
18
votes
9 answers

How do I detect orientation on app launch for splash screen animation on iPad!

Hi I have an app and I have two *.pngs for default splash screen: Default-Landscape.png Default-Portrait.png What I want is to animate this default splash screen away when my app is loaded and ready to go. To achieve this I would normally present…
17
votes
5 answers

Any way to get the name of iPhone user?

Outside of asking the user to input their name, is there any way to get it off the device? I tried this library, which attempts to extract the name from [UIDevice currentDevice] name], but that doesn't work in a lot of…
Andrew
  • 15,489
  • 25
  • 116
  • 200
16
votes
5 answers

Keep display on when the proximity sensor is covered

I want to intercept the proximity sensor without turning off the display. I know by the documentation that I have two Bool variables: proximityMonitoringEnabled proximityState and this code [UIDevice currentDevice].proximityMonitoringEnabled =…
Simone Pistecchia
  • 2,089
  • 2
  • 13
  • 21
16
votes
4 answers

How to use the identifierForVendor in ios5.?

I have using the following code for get identifier deviceName = [[UIDevice currentDevice]uniqueIdentifier]; But i got the warning uniqueIdentifier is deprecated in ios5. so how to get the identifier value in ios5?
user1208852
15
votes
2 answers

How to deal with `Use of undeclared identifier 'UIDevice'`

I followed the MD file step by step. But there is still an error in the compilation. What can I do? In the FaceppClient.m file : if ([[[UIDevice currentDevice] systemVersion] compare: @"5.0" options: NSNumericSearch ] != NSOrderedAscending) …
Creator
  • 156
  • 1
  • 2
  • 8
10
votes
1 answer

UUID for app on iOS5

Possible Duplicate: UIDevice uniqueIdentifier Deprecated - What To Do Now? As I expect you are aware of, the uniqueIdentifier in UIDevice is deprecated in iOS5. What I am looking for a basically the same functionality for iOS5. What I understand…
Paul Peelen
  • 9,588
  • 15
  • 82
  • 162
1
2 3
11 12