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
3 answers
Swift - Why is UIScreen.main.bounds behaving differently on different devices?
I am trying to create a game for IOS using SpriteKit. My problem is that different devices outputs different things. This is the code I try:
var testPath = CGRect(
x: 0,
y: 0,
width: UIScreen.main.bounds.width * 2,
height:…

Carl Jonsson
- 3
- 2
0
votes
0 answers
iOS - View above all other views with Safe Area
I would like to put a UIView above all other views. I saw that this is possible using the UIScreen object. However, it looks like the UIScreen doesn't have a Safe Area. This let's the View overlap with the Statusbar.
How can I place a View above…

evenwerk
- 947
- 1
- 12
- 28
0
votes
0 answers
Animate UIScreen brightness
I was trying to animate the brightness of UIScreen using,
[UIScreen mainscreen].brightness = 0.5
I looked around for ways to do it and found this thread very helpful. However, before looking at the answers in the thread, I tried updating the…

Works On Mine
- 1,111
- 1
- 8
- 20
0
votes
1 answer
UIScreen.main.bounds.width returning nil in Swift 3
In my project, I got messed up with two versions of app. I propably copied the project file and it created a problem. This line
myLogo.frame.size.width = UIScreen.main.bounds.width
shows, that UIScreen.main.bounds.width returns nil. How is that…

Bartosz Woźniak
- 2,065
- 3
- 14
- 31
0
votes
0 answers
an OS X application that uses two display monitors / changes its display monitor in runtime
I want to create a photo viewer that uses two displays: one normal display (1920x1080) and the other one is rotated (1080x1920). I'm doing this to maximize the photo size - landscape pictures would be displayed on the normal display in, and portrait…

Nimrod Yizhar
- 381
- 4
- 14
0
votes
2 answers
Adding an animation fade effect when the UIScreen Brightness is changed (Swift)
Just wondering if it is at all possible for the screen brightness to be changed with a fade effect. The screen brightness can yes be changed using UIScreen.mainScreen().brightness = CGFloat(1) but that just immediately changes the current brightness…

Z-Dog
- 171
- 1
- 8
0
votes
1 answer
How many iOS devices should I take into account for window sizes (point values)?
I've been working on setting my app up for all device sizes. I'm going to hard code all the frames (through my calculations) and use
CGRect frame = [[UIScreen mainScreen] bounds];
to obtain window size in points. I've tried Auto layout,…

Anthony Shintoluggenprog
- 35
- 1
- 8
0
votes
0 answers
UIScreen class is gone in ios10 simulator sdk
I used
[[UIScreen mainScreen] bounds].size.width
code before ios10.
But when I build this code using ios10 simulator sdk, it occurs error like
"Receiver 'UIScreen' for class message is a forward declaration No
known class method for selector…
0
votes
1 answer
Prevent brightness restore after screen unlocked in objective c
I changed my screen brightness using UIScreen, and from the documentation, the screen brightness will be restored to the system setting when the iPhone is locked and then turned back on.
Is there any way to prevent or work around this case?
I want…

ZigZagZebra
- 1,349
- 3
- 14
- 25
0
votes
1 answer
Swift: Can't create UIImageView from ViewController.swift
I have set up my UIImageView using the below setup. I am trying to draw on the view but can not get anything to appear. I am new to Xcode and want my view to automatically change depending on what the screen size is. When I have used the storyboard…

tadams22
- 37
- 5
0
votes
1 answer
How to get screen coordinates of view inside of keyboard accessory view?
Basically, i have put accessory view on top of the keyborad, inside that view i have view, for which i need the the position, but relative to whole screen (like i am putting it on the whole screen) and not the superview?
I kinda tried it like…

MegaManX
- 8,766
- 12
- 51
- 83
0
votes
2 answers
iPhone 6+ (Wrong scale?)
I have an iOS app using the camera to take pictures.
It uses a path(CGPath) drawn on the screen (for example a rectangle), and it takes a photo within that path. The app supports only portrait orientation.
For that to happen I use: AVCaptureSession,…

Michel
- 10,303
- 17
- 82
- 179
0
votes
2 answers
Why UIScreen mainScreen bounds size returns 568 for iPhone6 device?
I am getting 568p as screen height and scale factor 2x both for iPhone 5 and iPhone 6 [ios 9.2.1]. Why it is returning 568p instead of 667p for iPhone 6?
Device: iPhone (only)
Device Orientation: Portrait only
Launch Images:
Default.png …

DareDevil
- 902
- 8
- 21
0
votes
0 answers
Initwithframe UIScreen Mainscreen Bounds height is wrong ios 9
I'm trying to initialize a custom view in a viewcontroller. My custom view has the following code:
- (instancetype)initWithNib {
self = [super initWithFrame:[[UIScreen mainScreen] bounds]];
if (self) {
The problem is, when I run it in emulator, the…

stellarowl12
- 525
- 6
- 18
0
votes
1 answer
iOS: Detecting the actual screen size of iPhone
I'm not looking to get a scale of the size of screen. I'm trying to get the actual size of the screen. For iPhone 5. When I try to get the size of the iPhone 5 I get the size of the iPhone 4/4s.
Here is my code:
CGRect myScreen=[[UIScreen…

user2924482
- 8,380
- 23
- 89
- 173