A UIScreen object contains the bounding rectangle of the device’s entire screen. When setting up your application’s user interface, you should use the properties of this object to get the recommended frame rectangles for your application’s window.
Questions tagged [uiscreen]
153 questions
0
votes
0 answers
UIScreen.mainScreen().bounds shows unexpected value on phone, but not simulator
I have an iPhone 6 that I'm developing code for in Xcode and I am having problems with reported screen size, my phone reports the wrong value!
UIScreen.mainScreen().bounds:
Actual Value - 375 x 667
Reported Value (Simulator) - (0.0,…

J-Dizzle
- 4,861
- 4
- 40
- 50
0
votes
1 answer
Snapshot of UIView not scaling correctly?
I have a UIView canvas which I would like to save a screen shot of it and it's subviews (which are the colorful shapes) on the camera roll when I press the UIBarButton shareBarButton. This works on the simulator, however, it does not produce the…

14wml
- 4,048
- 11
- 49
- 97
0
votes
2 answers
Getting Wrong Screen Sizes in iPhone 6/6+
I am getting wrong screen size in iPhone 6 and 6+ by using
[UIScreen mainScreen].nativeBounds
and
[UIScreen mainScreen].bounds
In both case , i am getting wrong screen size.
So, I have added launch screen for iPhone 6 and iPhone 6+ then I get…

Hardik Shekhat
- 1,680
- 12
- 21
0
votes
1 answer
Instance member 'availableModes' cannot be used on type 'UIScreen'
I'm getting a build error while trying to access a documented property of UIScreen.
To reproduce
Xcode Version 7.2 (7C68)
iOS 9.2
Swift
Just try to compile -
import UIKit
class ViewController: UIViewController {
override func viewDidLoad()…

Maxim Veksler
- 29,272
- 38
- 131
- 151
0
votes
2 answers
How to get button x,y coordinate in a textfield
I have 4 different buttons for every corner of the screen. Just need to show their coordinates for every device changes in a text field or a label.
“x0” - button x coordinate on the screen
“y0” - button y coordinate on the screen
i should show like…

dicle
- 1,122
- 1
- 12
- 40
0
votes
0 answers
UIScreen bounds issue in ios 9
So I'm having this app on the app store since 2010, and my initalization code since that time looks like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow…

user826955
- 3,137
- 2
- 30
- 71
0
votes
1 answer
Placing an object in respect with screen in swift
I would like to set an image view in respect with screen and not the view. I have tried doing something like the following, but it does not work.
bgImgView = UIImageView(image: bgImage)
var scrFrame =…

Marcia
- 3
- 2
0
votes
2 answers
Getting iOS display resolution
An Application that is designed for a device of 480x960 pixel resolution is executed on a 480x1136 device. While running on the 480x1136 device I need to be able to detect the real resolution. Unfortunately, instead of getting the device resolution…

NadavRub
- 2,520
- 27
- 63
0
votes
0 answers
Share data between two UIWindows
My objective is to have an AirPlay option for my iOS app that shows the same content as the iPad (like a mirror) except slightly modified to the 16x9 aspect ratio of the TV.
I have all the initial setup complete, up to the point where I have the…

Jaun7707
- 119
- 2
- 9
0
votes
2 answers
iOS Simulator has different screen height between ios 7.1 and ios 8.2 for the same iPhone 5s
There is a weird issue for the iOS simulator to test iOS 7.1 and iOS 8.2 environment. When I try to get the screen size for iPhone 5s, the result is different. is this the bug in simulator? or is this the difference between iOS 7 and iOS 8?
Many…

Roger Zhang
- 15
- 4
0
votes
3 answers
[UIScreen mainScreen].bounds gives incorrect value
I'm building a landscape app in Xcode 6. When I run it on the iOS 8.3 simulator, [UIScreen mainScreen].bounds is 667x375, but when I run it on an iPhone 6 iOS 8, [UIScreen mainScreen].bounds is 375x667. This is causing problems for my app as many…

TheCodeMan54
- 143
- 2
- 5
0
votes
1 answer
Can't figure out how to get UpSide down orientation to work in iOS 8?
I added UIScreen bounds code in AppDelegate.m for iPhone 6 and now device orientation for iPhone 6 won't work for Portrait/ Upside Down. Upside Down is what's not working in simulator and devices.
Code in AppDelegate.m
CGSize iosScreenSize =…

Jet
- 555
- 1
- 7
- 19
0
votes
1 answer
How to implement iOS 8 nativeBounds code for device orientation
In iOS 8 bounds of ownership UIScreen class now reflects the orientation of the device. To fix this, I could use new nativeBounds of the property, instead of bounds. nativeBounds is measured in pixels. So what code what I put for pixels in .......…

Jet
- 555
- 1
- 7
- 19
0
votes
0 answers
UIScreenBrightnessDidChangeNotification not sending notification for brightness of 0.0
Normally registering for UIScreenBrightnessDidChangeNotification provides notifications when the user finishes sliding the brightness slider in control center.
It appears there is a bug that prevents notifications from being sent when the brightness…

Warpling
- 2,024
- 2
- 22
- 38
0
votes
3 answers
Problems setting dimensions of UIImageView
The code below does as follows:
detects width and height of screen
sets the dimensions of the screen to a UIImageView
sets position of the UIImageView to 0,0
Code (being run in viewDidLoad):
NSUInteger widthOfScreen = [UIScreen…

Minestrone-Soup
- 399
- 1
- 16