Reputation: 1287
Basically i wanted to implement a popup UIView so i followed what was posted here POP-UP UIView "IMDB App" style
This works very well. However i have one query. My main view is a tableView. so when a view is popped up i disable scrolling in the table. Now when the popup subView is removed, i need to re-enable scrolling. How do i achieve that? i can't use willRemoveFromSuperview because the popup view is loading a different NIB altogether.
Should i use Notifications?
hope i was clear with explaining the scenario.
Thanks in advance!
Upvotes: 1
Views: 2200
Reputation: 4388
Feloneous Cat has the correct answer. This is the perfect use a @protocol
in your popup view along with a registered delegate. Something is triggering that popup view to close. Whatever that trigger is, call the protocol and the delegate can handle the situation as needed.
Furthermore, when protocols are used correctly, your code becomes very reusable within a project as well as in other projects.
Upvotes: 2
Reputation: 519
What you could do is subclass UIView
and override removeFromSuperview
to send a notification. I don't think there's ever a case where a view gets removed without using the removeFromSuperview
method.
Upvotes: 1