syedfa
syedfa

Reputation: 2809

How to use UIActivityIndicator as a status indicator in real time for iOS?

]]I am trying to build a UIActivityIndicator for my iOS app so that it is displaying the current state of certain processes that are running, and each quarter segment of the wheel will be highlighted by a different colour, depending on the status.

All of the tutorials I have seen show how to build an activity indicator that spins while something is loading, whereas I need the indicator to remain on the screen and show state. I need the indicator to remain hollow, with only the circumference that is coloured. How would I do this?

Upvotes: 1

Views: 156

Answers (1)

anon_dev1234
anon_dev1234

Reputation: 2153

Core graphics. You'll have to make a custom class that inherits from UIView and do all the drawing yourself. You'll probably override a setter for a float (progress), which will update the display (using [self setNeedsDisplay]. Then in the drawRect: method you'll use this class property of progress to determine what color and what angle to draw/fill in the view. Check out the source of MBProgressHud for some reference: MBProgressHUD

Upvotes: 1

Related Questions