Search code examples
iphoneobjective-cxcodeuiactivityindicatorview

UIActivity Indicator Doesn't stop After called NSObject class's Function


I have two classes: ClassA and ClassB`.

  • ClassA implements UIViewController.

  • ClassB implements NSObject.

I have startAnimating UIActivityIndicator in classA's method at the same time i need to call one of the Class B's Methods. After executing Class B's method, I'll call new classA's method and then Stop Animating UIActivityIndicator. Here every thing is working fine, except StopAnimating. Please help me to find the solution. I don't know about threads, if I use thread, will it solve my problem?


Solution

  • threading seems like a complicated way to solve this. Why not retain a the UIActivity indicator in class A, and stop animating in the method you call in class A from B. Woo sounds complicated.

    Theres not reason why you cant pass a pointer the activity indicator to any class.

    If this doesn't work for you I'd look at notications rather than going down the multi-threaded route