How do I turn on iphone screen programmatically when it's dimmed [duplicate] - ios

This question already has answers here:
Is there a way of adjusting the screen brightness programmatically?
(3 answers)
Closed 9 years ago.
Before iphone lock the screen, it will dim the screen first for a while. I wonder how to lighten the screen in my app at that time without touching the screen. Can anyone give a help?
To be more specific: I don't want to prevent the system sleep, nor adjust the screen brightness. What I want is to lighten the screen when I got a certain event to notice the user while the screen is dimmed.
Just solve this problem in a tricky way..
- (void)lightenTheScreen
{
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}

That is default behavior of the iPhone. To prevent that nature you can use following code.
[[UIApplication sharedApplication] setIdleTimerDisabled: YES]; //Add this at the end in your applicationDidFinishLaunching application
From APPLE DOCUMENTATION
"The default value of this property is NO. When most applications have
no touches as user input for a short period, the system puts the
device into a "sleep” state where the screen dims. This is done for
the purposes of conserving power. However, applications that don't
have user input except for the accelerometer—games, for instance—can,
by setting this property to YES, disable the “idle timer” to avert
system sleep. "

Related

Is there anyway to stop screen-lock while my app is in foreground in iOS App?

I do not want the user to be able to lock the screen while app is in foreground, even when the user forcefully tries to lock the screen with hardware lock button. Is there anyway to make it function programmatically?
Please do not tell me idleTimerDisabled property of UIApplication class.
[UIApplication sharedApplication].idleTimerDisabled = YES;
It does not work for what i'm looking.
This is not possible using the iOS SDK. You have no mechanism for making the user unable to do things like lock the screen or not press the home button.

How do I control the notification counter for my home screen app icon? [duplicate]

This question already has an answer here:
How do I use the numeric notification "bubble" in iOS?
(1 answer)
Closed 7 years ago.
When one first turns on one's iPhone, one is presented with this screen that lists all the apps installed in that phone. Some of them might have little red circles with white numbers in them that represent unread notifications from that app. Now I'm making an iOS app, and I want to trigger the appearance of white numbers in red circles like this. How do I do that?
Just use:
[[UIApplication sharedApplication] applicationIconBadgeNumber:numberDesired];
Sets the number currently set as the badge of the app icon in Springboard.
Set to 0 (zero) to hide the badge number. The default value of this property is 0.

Touch ID dialog showing a second status bar

When I let the user login into my app with Touch ID, I get the dialog (which by the way is very ugly and cannot be customized) and I also get a second status bar, which looks like this:
Is there any way to hide the status bar?
If not, set the status bar style to my style (UIStatusBarStyleLightContent)?
(I also would be very happy if someone knows of a way to customize the dialog, more than just changing labels)
i fixed this
just hide status bar when open touch id like this
[[UIApplication sharedApplication] setStatusBarHidden:YES];
not show after failure or success with perform selector with 1 sec delay like this and my code working perfectly
[[UIApplication sharedApplication] setStatusBarHidden:NO];
Did you see this behaviour on iPhone 6/6+ ?
If yes, the way I solved it was by setting the appropriate launching xib so that iPhone 6 and 6 plus devices are using the native resolution without being scaled. (see also this question on how to do that How to enable native resolution for apps on iPhone 6 and 6 Plus? )

How to create a custom alarm wake up screen on iOS?

Is it possible to create a custom alarm wake up screen on iOS via Xcode, such as the carrot alarm app on the App Store? If so, could anyone point to some documentation or examples?
I'm pretty confused at the moment, because I don't understand how it can be done as long as the iPhone locks itself and the app stops working. This is my main concern, because locking the iPhone kills the app.
I would like to what's the best way to create a wake up screen like carrot app's one, avoiding all the screen lock problems. How did they do it?
Thanks
Using the code below you can disable the lock screen. You can place it in your viewDidLoad method.
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
As for creating the screen, I'd suggest picking up a book on iPhone development as it's a lot to explain in a follow-up message.

Prevent iPhone auto-lock, but permit screen dimming

I have an application which works in a hands busy environment so the user rarely touches the device. Of course, the phone goes into auto-lock and my app stops working. I used this code:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
to prevent the device and that is fine. However, I would still like the screen to auto-dim. The above code keeps the screen from auto-dimming as well as auto-locking.
This question shows me how I can dim the screen manually, and that just may be a good enough solution. But I'd rather use system settings, not app settings.
So how can I prevent auto-lock while still getting the auto-dim?

Resources