
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Change Size of UIActivityIndicator in Swift
It is possible to change the size of UIActivityIndicator in swift using some tricks but it’s not recommended to change the size. To change the size of activity indicator let’s first add an indicator on an empty screen and see how it looks. For this example, I’ll also change the color to red.
Let’s see how it looks when we run it without changing the size of the indicator.
Now, we’ll create an outlet of activity indicator in our view controller and in the viewDidLoad method of this class we’ll add the code below.
We’ll use CGAffineTransform to change the scale of our indicator. When we change the scale to 2.5x this is how it looks on the iPhone.
let transfrom = CGAffineTransform.init(scaleX: 2.5, y: 2.5) activityIndicator.transform = transfrom
This is how it looks on the iPhone, which is blurred and not as perfect as the actual indicator. Hence it is not a recommended way to increase the size of the indicator.