MJPopupViewController icon indicating copy to clipboard operation
MJPopupViewController copied to clipboard

Press close button- still show fade background

Open gran33 opened this issue 11 years ago • 8 comments

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

gran33 avatar Oct 23 '13 15:10 gran33

+1, I'm seeing this as well.

raid5 avatar Jan 06 '14 19:01 raid5

+1, use NSNotificationCenter as a quick hack for now

benaneesh avatar Feb 11 '14 00:02 benaneesh

Also seeing this

Paludis avatar Mar 28 '14 11:03 Paludis

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.

feef avatar May 12 '14 19:05 feef

Maybe this workaround will help you guys out in:

  • (void)slideViewOut:(UIView_)popupView sourceView:(UIView_)sourceView overlayView:(UIView*)overlayView withAnimationType:(MJPopupViewAnimation)animationType

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]; }

revisedagain avatar Jun 27 '14 13:06 revisedagain

+1

tracy-e avatar Jul 01 '14 10:07 tracy-e

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

hoangnn89 avatar Jul 18 '14 01:07 hoangnn89

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

  • (IBAction)okButtonTapped:(id)sender { [self.delegate dismissPopupViewControllerWithanimationType:MJPopupViewAnimationSlideTopBottom]; }

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

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

SyedIsmailAhamed avatar Apr 21 '15 08:04 SyedIsmailAhamed