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:

174 questions
0
votes
0 answers

How would I get my app to constantly update the battery level?

My app has a battery level indicator in it, and I would like to have it update while still on the battery level indicator page. Currently, if I keep my app open to that screen and the battery level changes (by more than 5%), the app crashes. What…
cory ginsberg
  • 2,907
  • 6
  • 25
  • 37
0
votes
1 answer

Playing a sound on tap on a key on custom number pad

I am creating and putting a custom number bar on top of regular keypad. Now, when I tap on the keys in the numberpad, I want the regular keyboard sound to play. I am using the below code in the button pressed delegate. Log statement prints but there…
Abhinav
  • 37,684
  • 43
  • 191
  • 309
0
votes
1 answer

Restrict installation of iOS app for iphone 4 & iphone 4S only (Retina Display)

I am developing iOS app. I want this app to be installed on ONLY iPhone 4 & 4S having Retina Display (due to requirement of app). My plan is to add the UIRequiredDeviceCapabilities in info.plist & set Front Camera as required functionality. So in…
iOSAppDev
  • 2,755
  • 4
  • 39
  • 77
-1
votes
1 answer

Retrieving battery level only works the first time I do it

When my app is first launched, the battery level is correctly retrieved by float batteryLevel = [UIDevice currentDevice].batteryLevel. However, when I try to retrieve it later on in my code, I always get the same value even if the battery level…
Wakeen
  • 1
-1
votes
1 answer

systemVersion equivalent for AppKit

Is there a way to get systemName (e.g. macOS or Mac OS X) in AppKit? Essentially, I am looking for a AppKit equivalent of the following UIKit command: [[UIDevice currentDevice] systemName] EDIT: Please note that I am not looking for OS version, I…
Vibhor Goyal
  • 2,405
  • 2
  • 22
  • 35
-1
votes
3 answers

Orientation don't change in second time

i have this code below, that recognize when the device change his orientation, and if the orientation are landscape left or right, he back again to portrait: [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; …
Belzum Nulls
  • 41
  • 1
  • 1
  • 9
-2
votes
1 answer

Is there anybody who could help me to convert Objective-C UIDevice+SystemVersion into Swift?

I don't know how to convert the following Objective-C code into Swift as I have not worked with Objective-C before. How should I do it? If somebody has encountered something similar, any help of how the Objective-C code below would look like in…
MarisLakss
  • 11
  • 3
-2
votes
1 answer

Swift: Can't change class attribute from @objc function

I'm trying to capture ProximitySensor activity on SwiftUI. So I've created a class ProximityOberver and trying to update the attribute 'state' in the notification: import SwiftUI import UIKit class ProximityObserver { @State var state = false; …
-5
votes
1 answer

Find out which iPhone version

My app uses the camera and face recognition extensively and I recently found out that it's slow on the iPhone 4. I know you can find the ios version and what type of device it is. Is there a way to find out programmatically which iPhone is being…
Jay
  • 21
  • 1
  • 5
1 2 3
11
12