Search code examples
objective-cencapsulation

Updating UI from another class


I have two classes (Class A & Class B). Class B downloads and processes some data while class A shows a progressView.

I need the progressView in Class A to update when called by the Class B.

Currently I have the following in Class B.m:

ClassA* classA= [[ClassA alloc] init];

[classA didStartLoadMethod];

and inside Class A.h:

- (void)didStartLoadMethod;

Inside ClassA.m

- (void)didStartLoadMethod;
{
    _progressView.progress = 0;
}

But the progress view will not update unless didStartLoadMethod is called from class A.

Are the any other ways of doing it? Am I doing it wrong?

Any help would me much appreciated and/or any other solutions. Thanks


Solution

  • After a while of playing around I just settled for a NSNotification.