- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to prevent the screen from sleeping in iOS?
In this post we will be seeing how to prevent screen from sleeping in iOS.
So, let’s get started.
Copy the below line of code in viewDidLoad method in ViewController.Swift
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. UIApplication.shared.isIdleTimerDisabled = true }
Run the application, the application will never go in sleep mode.
Advertisements
To Continue Learning Please Login
Login with Google