martinjuhasz / MJPopupViewController

A UIViewController Category to display a ViewController as a popup with different transition effects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't push to viewcontroller in navigation controller

JulesMoorhouse opened this issue · comments

Hi, thanks for your awesome library.

I've managed to load and display my first view controller with a navigation controller.

        [self.navigationController pushViewController:vc animated:NO];

However within that view I can't push another view controller, any suggestions?

Here's my initial code..

    SettingsLoginVC *detailViewController = (SettingsLoginVC*)[[self storyboard] 
         instantiateViewControllerWithIdentifier: @"sb_SettingsLoginVC"];

    //detailViewController.delegate = self;

    [self presentPopupViewController:detailViewController 
       backgroundSource:[SharedCommon imageWithView:self.view] 
       animationType:MJPopupViewAnimationFade dismissed:^{

    }];

Did you got answers? if not

Try this
make delegate in your viewcontroller and call your delegate where you want to show popup class file

-(void)submit:(MJSecondDetailViewController *)secondDetailViewController{
TestViewController *secondDetailViewControllers = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
[self dismissPopupViewControllerWithanimationType:0 dismissed:^(bool say){
if (say==YES) {
[self.navigationController pushViewController:secondDetailViewControllers animated:YES];

    }
}];

}

and i have added method in UIViewController+MJPopupViewController.h

  • (void)dismissPopupViewControllerWithanimationType:(MJPopupViewAnimation)animationType dismissed:(void(^)(bool say))dismissed;

and UIViewController+MJPopupViewController.m file

  • (void)dismissPopupViewControllerWithanimationType:(MJPopupViewAnimation)animationType dismissed:(void(^)(bool say))dismissed{
    UIView *sourceView = [self topView];
    UIView *popupView = [sourceView viewWithTag:kMJPopupViewTag];
    UIView *overlayView = [sourceView viewWithTag:kMJOverlayViewTag];

    switch (animationType) {
    case MJPopupViewAnimationSlideBottomTop:
    case MJPopupViewAnimationSlideBottomBottom:
    case MJPopupViewAnimationSlideTopTop:
    case MJPopupViewAnimationSlideTopBottom:
    case MJPopupViewAnimationSlideLeftLeft:
    case MJPopupViewAnimationSlideLeftRight:
    case MJPopupViewAnimationSlideRightLeft:
    case MJPopupViewAnimationSlideRightRight:
    [self slideViewOut:popupView sourceView:sourceView overlayView:overlayView withAnimationType:animationType];
    break;

    default:
        [self fadeViewOut:popupView sourceView:sourceView overlayView:overlayView];
        break;
    

    }
    dismissed(YES);

}

Thanks.