Display navigationController on top

前端 未结 2 1559
别跟我提以往
别跟我提以往 2020-12-12 05:08

I have set up a subview \"popup\" in my application and I want to show a navController if the user taps a button on the subview popup. I\'ve set up the button so far, but if

相关标签:
2条回答
  • 2020-12-12 05:27

    I noticed this line of code:

    [[KGModal sharedInstance] showWithContentView: contentView andAnimated: YES];
    

    And I can only think that, since it is a singleton, it adds the contentView on the UIApplication's key window. If that is the case, then a modal view controller will always be below the popup. You can solve this by adding a new method to the KGModal class

    - (void) showWithContentView: (UIView*)           contentView
                inViewController: (UIViewController*) controller
                     andAnimated: (BOOL)              animated;
    

    the method should show the popup in the specified controller's view; you should use that method instead.

    Edit

    After some more digging, I found that KGModal displays the popup on another window. The quickest fix would be to dismiss the popup, then show the nav controller.

    0 讨论(0)
  • 2020-12-12 05:35

    From the so far discussion and debugging the code you want to have the photo browser on the pop-up with a navigation controller.

    So here is the sample code which implements this functionality, have a look at it.

    I have used the same KGModal sample code and extended as per the requirement. I have used Xib to have a view with navigation bar.

    To dismiss the pop-up from any where in the app you can use the below line, as it is shared instance.

    [[KGModal sharedInstance] hideAnimated:YES];
    

    Update:

    The reason for showing the photo browser with in folderView is, you are trying to present the photoBrowser within the folderView, so it was presenting within the folderView of very small height & not able to see any photo.

    So my suggestion is, as the user taps on pop-up to view photoBrowser you just remove pop-up and present the photoBrowser from the viewController class, as other than this class everything is handled through views.

    I have made the changes as per above & works fine, to the code given by you, download the code here and have a look at it.

    Let me know if it fulfills your needs.

    Thanks

    0 讨论(0)
提交回复
热议问题