user1508829
user1508829

Reputation: 3

Making a reference to an UIViewController from an ObjectiveC class

So my question is: How to make a reference to a UIViewController from an outside ObjectiveC class. I have a ViewController, and a UIScrollView on it, and a class that needs to override some methods, and eventually return said UIScrollView. So, i figured that the easiest way to do this is to type:

return destinationViewController.scrollView;

but i don't quite know how to make the destinationViewController reference. Help?

Upvotes: 0

Views: 160

Answers (1)

Miro Hudak
Miro Hudak

Reputation: 2215

You should be able to pass it as a parameter to the outside class, otherwise you should rethink your class design. In worst case, you can store it in AppDelegate or some specialized singleton (or public static field (like static UIViewController *g_ViewController) in the worst worst case)...

Upvotes: 1

Related Questions