Vad
Vad

Reputation: 3740

Access UINavigationController from UIView Subclass

I have a subclass of UIScrollView. This custom subclass has a method that is supposed to initialize opening of a new UINavigationController. I understand that subclasses do not deal with this type of approach but how would I handle this kind of scenario in an ideal way?

Upvotes: 0

Views: 641

Answers (1)

rooster117
rooster117

Reputation: 5552

I would think the ideal way to handle this would be to declare a custom delegate protocol method for your subclassed UIScrollView. You would then set your UIViewController which I assume is the parent to the custom scroll view and when it intercepts this delegate callback just do a simple:

[self.navigationController popViewControllerAnimated:YES];

Upvotes: 1

Related Questions