cezarywojcik / CWPopup

CWPopup category to present popup view controllers
MIT License
289 stars 62 forks source link

Close from inside the popup controller #1

Closed jaiversin closed 11 years ago

jaiversin commented 11 years ago

Hi,

Is there a way to dismiss the popup view from the presented view controller?

Thanks.

cezarywojcik commented 11 years ago

If you have, say, a UIButton in the popup view controller, you can hook up the dismissal from your main view controller something like this:

[self.popupViewController.myButton addTarget:self action:@selector(dismissButtonClicked:) forControlEvents:UIControlEventTouchUpInside];

Then, call the dismiss function in dismissButtonClicked.

jaiversin commented 11 years ago

I was thinking about something like an own function for dismissing (on the category, I think), but it just works.

Thanks!

bagusflyer commented 10 years ago

I think it's more convenient if it's possible to dismiss the view controller inside the popup itself.

MJACOBS84 commented 9 years ago

[self.parentViewController dismissPopupViewControllerAnimated:YES completion:^{ NSLog(@"popup view dismissed"); }];

call this on your popup view controller. don't forget to import #import "UIViewController+CWPopup.h" ;)

seandeng commented 9 years ago

thanks MJACOBS84 , it works for me :+1: