Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we programmatically change the brightness of the iPhone screen?

Tags:

How can I change the brightness of the screen programmatically using iPhone SDK?

like image 595
meetpd Avatar asked Jan 20 '12 05:01

meetpd


People also ask

How do I automate the brightness on my iPhone?

Adjust the screen brightness automatically iPhone adjusts the screen brightness for current light conditions using the built-in ambient light sensor. Go to Settings > Accessibility. Tap Display & Text Size, then turn on Auto-Brightness.

How do I force my screen brightness?

The easiest way is to look on your keyboard for an icon that looks like a sun. It is usually found over the F1 and F2 keys, with the F1 key dimming the display and F2 brightening it. The shortcut key for brightness on a desktop computer only requires you to press F2 until you achieve the desired brightness.


1 Answers

[[UIScreen mainScreen] setBrightness: yourvalue];

Requires iOS 5.0 or later. yourvalue is a float between 0.0 and 1.0.

like image 114
Peter Sarnowski Avatar answered Jan 11 '23 15:01

Peter Sarnowski