Roger
Roger

Reputation: 243

iphone - delegates

I have an object that belongs to a class. Lets call it classA. This classA is a subclass of classB.

ClassA has a delegate protocol.

I create an classA object on my main code. This object is inside a view. Lets call it viewX.

Now I am in classB and I would like to get a reference to viewX.

remember that classA has a delegate protocol, so it has a reference to its delegate, that is the viewController where viewX is. From class A I can access viewX doing [delegate view], but how do I do that from classB???

thanks.

Upvotes: 1

Views: 124

Answers (1)

Omar
Omar

Reputation: 1574

If you have access to class B, I would say you should add a variable to the class of type id, and set that variable as the view, and that would be a very easy way to do it. Otherwise, I don't think it's possible. But I may be wrong.

Upvotes: 2

Related Questions