- Trending Categories
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 make a background 25% transparent on iOS
Apple provides backgroundColor which is an instance property, Changes to this property can be animated. The default value is nil, which results in a transparent background color.
To make background 25% transparent we should set the view to the UIColor with alpha 0.25
view.backgroundColor = UIColor(white: 1, alpha: 0.25)
You can write the following code in your ViewController’s viewDidLoad method.
Your code should look like below.
override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = UIColor(white: 1, alpha: 0.25) }
Advertisements