For my use case, I do not need to access the indicator view any more. Also if the complete view will be removed (due to dismissing the ViewController), I am not caring about those UIActivityIndicators.

So will this type of usage be safe and not create any memory/resource leftovers? I have checked, that dealloc of UIActivityIndicatorView is called (and it is), so I would assume the animation will be stopped/removed automatically as well while the view hierachy is destroyed.

1 Answer
1

Yes, once you've relinquished ownership of the indicator, the view hierarchy remains the only owner. If a superview is removed from the view hierarchy and if it is not retained elsewhere, the superview releases all its subviews. If the subviews hit a retain count of zero, they are deallocated. This is what is happening with your indicator view.