- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to change screen brightness programmatically in iOS?
To change the brightness of the screen we have to use the brightness property of the screen, This property is only supported on the main screen. The value of this property should be a number between 0.0 and 1.0, inclusive.
Brightness changes made by an app remain in effect until the device is locked, regardless of whether the app is closed. The system brightness (which the user can set in Settings or Control Center) is restored the next time the display is turned on.
It’s an instance property, To implement this in your iOS Application (any application) add below line in viewDidLoad method to see the effect.
UIScreen.main.brightness = 0.1 // (0-1)
- Related Articles
- How to change screen brightness programmatically in android?
- How to lock Screen Orientation programmatically in iOS?
- How to change Screen Orientation programmatically using a Button in Android?
- How to change Screen Orientation programmatically using a Button in Android Kotlin?
- How to answer incoming call programmatically in iOS?
- How to get screen DPI programmatically in Android?
- How to take a screenshot programmatically in iPhone/iOS?
- How to enable/disable data connection in iOS programmatically?
- How to create Picker programmatically from array in iOS?
- How to programmatically prevent scrolling in WebView of iOS?
- How to lock & unlock the iOS device programmatically
- How to programmatically take a screenshot on iOS?
- How to prevent the screen from sleeping in iOS?
- Disable Scroll View Programmatically in iOS?
- How do I programmatically “restart” an iOS app?