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
4
votes
2 answers
Detecting External Screen with iOS Swift
I am trying to detect an external display using iOS Swift. The second display is connected with a Lightning Digital AV Adapter. I have imported UIKIt. When I run the code below screens.count just gives me 1 even if I start the app with the second…

jumpwire
- 101
- 1
- 9
4
votes
2 answers
Swift iOS -How to Add Subview to Window's Center?
I have an activity indicator that gets presented on an iPhone and iPad. In the iPad in split screen mode it gets presented to whichever side of the view that called it. I would instead like it to get presented in the middle/center the window's…

Lance Samaria
- 17,576
- 18
- 108
- 256
4
votes
2 answers
UIScreen.mainScreen().nativeBounds.height not working using Xcode 7/Swift 2, Target iOS7
In the past when I've used Xcode 6.4, I have been able to adjust things like font sizes, etc. based on device sizes. This was for my apps that were targeted at iOS 7. Now for Xcode 7 and Swift 2 it only allows for this with iOS 8 and newer. It…

ChallengerGuy
- 2,385
- 6
- 27
- 43
4
votes
1 answer
How to get host app screen geometry for iOS 8 custom keyboard inside iPhone app running on iPad?
My Custom keyboard has presets for each screen resolution of all Apple devices. So I have iphone, iphon5, iphone6, iphone6plus and ipad presets.
But in case user runs iPhone app (like instagram) on iPad, I need to load iphone keyboard preset and use…

Modo Ltunzher
- 648
- 5
- 12
4
votes
1 answer
[UIScreen mainScreen].bounds vs [UIApplcation sharedApplication].keyWindow.bounds?
I have view that i want to cover entire screen. And i want to set its frame to cover entire screen. Browsing the stack overflow i found these two different ways of setting view frame to cover the screen:
[UIScreen mainScreen].bounds
[UIApplcation…

MegaManX
- 8,766
- 12
- 51
- 83
3
votes
1 answer
Airplay on new Apple TV (3rd gen.) for second screen not at 1080p
I am working on an app that uses Airplay mirroring for a second display that has different content to the iPad itself. I'm using an iPad3 and ATV3 (i.e. released March 2012) attached to an LCD capable of 1920x1080 via HDMI.
With Airplay mirroring,…

henri
- 31
- 1
- 2
3
votes
1 answer
Are screen connect/disconnect notifications working with iOS 5?
Is anyone still getting, with iOS 5, screen connect/disconnect notifications, regardless of whether you check mirroring or not? I don't seem to be getting any notifications, unless I plug a video-out cable to my device, instead of using AirPlay.
I…

mahboudz
- 39,196
- 16
- 97
- 124
3
votes
1 answer
UIScreen main bounds does not respect actual device screen size
I wanted to create a project without any storyboards.
I have deleted the Main and LaunchScreen storyboards.
As usual I added to my applicationDidFinishLaunchingWithOptions:
window = UIWindow(frame: UIScreen.main.bounds
…

Makaronodentro
- 907
- 1
- 7
- 21
3
votes
1 answer
Main screen size is always 320x480?
I noticed something weird: if I delete all launch images/storyboards from an iOS app project, then UIScreen.main.bounds shrink to 320x480, regardless of an actual screen size.
My question is: do I need a launch image/storyboard to make sure that the…

Aliaksei
- 998
- 8
- 10
3
votes
1 answer
"UIScreen' doesn't have the member 'main'
Environment:
Xcode Version 8.1 beta (8T47)
Apple Swift version 3.0.1 (swiftlang-800.0.56 clang-800.0.42)
The Swift 3.0.1 compiler flagged 'UIScreen' as '...no member'.
...but the UIScreen file does have 'main':
@available(iOS 2.0, *)
open…

Frederick C. Lee
- 9,019
- 17
- 64
- 105
3
votes
2 answers
When I rotated the simulator, there are many black blocks around UIWindow
How to get the black blocks disappear?
And after the rotation, the black blocks disappear.
AppDelegate Source File:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIStoryboard…

Frank Wang
- 31
- 3
3
votes
0 answers
iPhone Force Adjust External Screen Resolution
The application in question must allow the user to select one the available screen modes of the selected display. For example, an external display may natively support 1920x1080 but it's EDID will also show supported resolutions of 1920x1200,…

Michael Voccola
- 1,827
- 6
- 20
- 46
3
votes
1 answer
UIScreen bounds and applicationFrame difference between iOS6 and iOS7
Using iPhone4s iOS7, Screen orientation is Landscape
-Build an application with below SDKs
I built the application with iOS6 SDK and iOS7 SDK, and checked each of the screen resolution. Below shows the result:
iOS6 SDK:
[[UIScreen mainScreen]…

TGT
- 78
- 5
2
votes
1 answer
Getting the screen brightness value in iOS 5
I've started to use the new iOS 5 brightness setter in UIScreen. Is there a getter property I can use to know what the display brightness is set to on launch?
Thanks very much.

W Dyson
- 4,604
- 4
- 40
- 68
2
votes
3 answers
setBrightness in appdelegate methods?
Why can't I set screen brightness in applicationDidEnterBackground or applicationWillResignActive?
This is my code:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[[UIScreen mainScreen] setBrightness:1.0];
}
Can't…

Adam Waite
- 19,175
- 22
- 126
- 148