martinjuhasz / MJPopupViewController

A UIViewController Category to display a ViewController as a popup with different transition effects.
MIT License
963 stars 219 forks source link

Press close button- still show fade background #49

Open gran33 opened 11 years ago

gran33 commented 11 years ago

Hi,

When i invoke: [self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade]; From my popup, the popup dismiss, but the background ViewController still fade.

How can i fix it?

10x in advance!

Ran

raid5 commented 10 years ago

+1, I'm seeing this as well.

benaneesh commented 10 years ago

+1, use NSNotificationCenter as a quick hack for now

Paludis commented 10 years ago

Also seeing this

feef commented 10 years ago

The problem appears to be from using "- (void)presentPopupViewController:(UIViewController*)popupViewController animationType:(MJPopupViewAnimation)animationType" to present a view controller with a view that is the full size of the screen. It appears that the project is expecting your viewcontroller's root view to be only the size of the content inside. So, if you're making a view controller and adding a subview to that view controller's view, you must also resize your view controller's view property to be exactly the size of the subview you want to show.

Also, another little note, if you dismiss from a different view controller than you presented from, the background darkness will not properly fade with the rest of the foreground view. For proper appearance, you MUST present and dismiss from the same view controller.

revisedagain commented 10 years ago

Maybe this workaround will help you guys out in:

set up NSnotificationcenter IE:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:@"slideOutDone" object:nil];

fire it in the animation completion:

    [[NSNotificationCenter defaultCenter]
     postNotificationName:@"slideOutDone"
     object:self]; 

your handler will be something like:

-(void)handleNotification:(NSNotification *)pNotification { [dismissButton sendActionsForControlEvents:UIControlEventTouchUpInside]; [[NSNotificationCenter defaultCenter] removeObserver:self]; }

tracy-e commented 10 years ago

+1

hoangnn89 commented 10 years ago

Send notification to presenting view controller to dismiss will help :)

SyedIsmailAhamed commented 9 years ago

There is a simple fix for this, hope it helps some one,

create a sample delegate in the view controller which is about to be presented

in this case Test View Controller is the view controller which am presenting

/\ Test View Controller .h**/ @interface TestViewController : UIViewController<UITableViewDataSource,UITableViewDelegate> { id delegate; } @property (nonatomic, assign) id delegate;

/Test View Controller.m/

//button action to dismiss

//while presenting don't forget to set delegate/

TestViewController* previewVC=[[TestViewController alloc]init]; previewVC.delegate=self; [self presentPopupViewController:previewVC animationType:MJPopupViewAnimationSlideTopBottom dismissed:nil];