Change to wantsSoftwareDimming in iOS 6? - ios

This is regarding the question: Turn off display in iPhone OS (iOS)
As alternative to turning off display, I am looking for a way to dim screen as much as possible.
I found following questions:
How to change brightness in iOS 5 app?
Make the iPhone Screen Dim
And this documentation:
http://developer.apple.com/library/IOs/#documentation/UIKit/Reference/UIScreen_Class/Reference/UIScreen.html
Per this questions/documentation, I should be able to do this to dim screen additional to decreasing backlight.
[[UIScreen mainScreen] setWantsSoftwareDimming:YES];
I tried this code on my iPad 2 (iOS 6.0). However, I didn't notice any change in brightness of display.
a) Am I doing something wrong?
b) Were there any changes in iOS regarding this?

setWantsSoftwareDimming: won't on itself do anything to the screen. It will instead change the scale that the brightness property of UIScreen uses. You should be calling it before you call setBrightness:. Perhaps if you post the method in which you set the brightness / call setWantsSoftwareDimming you might get some more useful feedback?

Related

Objective C App has wrong [UIScreen mainScreen].bounds value since iOS 16

Device: Physical iPhone X (16.0.2)
A legacy app (Objective C) of my client has worked just fine on iOS 15. On iOS 16 though, the app has suddenly 'shrunken in height'. The app opens as usual but on the top and bottom of the screen, there are black bars, as the app itself seems to be constrained to a certain size.
After some investigation, I found out that the device actually reports its Screen Height to be 480pt (iPhone X). Forcing the UIWindow to have a different size doesn't solve the issue, the app is still constrained to be the same wrong height. It seems the device 'actually believes' to be shorter than it is.
Since this behavior kind of resembles what happens when starting an iPhone app on an iPad (at least I remember seeing something like that some time ago), I was wondering whether or not this behavior is expected as of iOS 16?
If not, I would really appreciate some help here.
EDIT: I learned that +[UIScreen mainScreen] is deprecated as of iOS 16 so using that to initialize the window might be the issue. Though there seems to be no alternative for accessing this info all the way back in the AppDelegate. It was suggested to use self.view.window.windowScene.screen for reading a device's screen size, but sadly this is not accessible in the AppDelegate.
WORKAROUND:
I was not able to find the root cause of the issue but could resolve it by using storyboards to load the initial ViewController. This caused the system to automatically create a window, which was not affected by this weird system behavior.

How to adjust values in Xcode to depend on device played (iPhone vs. iPad)

I am currently making a classic snake game app.
The app fits and works on all iPhones however when I test on any iPad the lettering is off the screen and so is the game screen.
Is there anyway to adjust the proportion or have it depend on what device you are using?
I was unable to find much help online when looking for this question. (first image is an iPhone 7, and the second is an iPad Air 2.
What you're looking for is Adaptive User Interfaces. You should be able to have different layouts for different device sizes using a single storyboard.
You can also change values programatically in your code according to the screen size.

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 correct size of screen in iPhone 6 and iPhone 6+.
But another problem is that My App UI displaying wrong. All Screens of app left right padding. See below image :
If I remove launch screen for iPhone 6 and 6+ then App UI is displaying right as displaying before like below image :
In above image, no right padding.
I have also check by adding launch screen but that also getting wrong screen sizes.
Note : I have used AutoResize in app and It is working good in whole app.
I have also do so much googling to find out actual problem but unfortunately can't get it. Thanks so much in advance If anyone help to sort out that problem.
Sorry, did you check Settings -> Display and brightness -> View (Standart)?
One of the possible patch to identify your screen type is by getting the scale of your screen. You can use the following code : [UIScreen mainScreen].scale;
This will not let you know the exact screen size but will allow you to know what is the scaling. This method might be helpful where you need not to code individually for different screens and majorly do not want to convert your entire code to autolayout.
To know the scaling factor of different screens refer to following link : http://www.paintcodeapp.com/news/iphone-6-screens-demystified

iOS - Change the screen color temperature [duplicate]

This question already has answers here:
Is there a way of adjusting the screen brightness programmatically?
(3 answers)
Closed 9 years ago.
I want to build an iOs app like f.lux.
It changes the screen brightness of device based on daytime.
I know I have to jailbreak my device. But I don't know how to implement this app.
Please suggest me any useful API to do that.
Thanks in advance.
iOS already has that system-wide feature built-in: see Settings > Brightness & Wallpaper, under Auto-Brightness:
Although it is possible to programmatically control the device's brightness, there is not a public API for determining the outside light, so this is functionality that the OS handles.
Try this (iOS5 and greater only):
[[UIScreen mainScreen] setBrightness:1.0];
From related question: Adjust the brightness of the screen through code
Go through the brightness property of UIScreen which is a new API available after IOS5.

Is it necessary to adjust the height and width of the stage manually if I want to force a landscape orientation?

I'm just learning to code for iOS using Adobe AIR. I'm familiar, though not very experienced, with ActionScript 3.
I want my app to remain in landscape no matter how the device is oriented. I know that to set the orientation for an iOS device, I'd have to set <autoOrients>false</autoOrients> and <aspectRatio>landscape</aspectRatio>. However, as I'm using Adobe Flash Professional, I was wondering if I need to change my stage's height and width to reflect this change in the actual app.
Thanks!
No you don't have to, once those settings are set it will be handled automatically. stage.stageHeight and stage.stageWidth should report the correct dimensions when the stage is in landscape mode.
Stage.width and Stage.height are readonly.
To force landscape use app descriptor xml definitions like:
landscape
true

Resources