UIModalTransitionStylePartialCurl doesn't get back to previous state. (Not dismissing)

前端 未结 1 1432
小鲜肉
小鲜肉 2020-11-27 23:20

I\'ve got 2 view controllers, let\'s say A and B. In A, I\'m calling B to be shown with transition style UIModalTransitionStylePartialCurl

[b se         


        
相关标签:
1条回答
  • 2020-11-27 23:35

    Here is the link to Apple site for the Modal View Controllers

    Basically, you need to setup delegate, etc. And call dismissModalViewControllerAnimated: method from your viewcontroller A. Let me know if you need further help.

    Edit per MiiChiel:

    In BController.h file, add this:

    @protocol BControllerDelegate <NSObject>
    -(void)dismissMe;
    @end
    
    @interface BController : UIViewController
    //...
    @property (assign) id <BControllerDelegate> delegate;
    //...
    @end
    

    In BController.m file, add this:

    @implementation BController
    @synthesize delegate;
    //...
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    {
        [self.delegate dismissMe];
    }
    

    In the AController.h file, add this:

    #import "BController.h"
    
    @interface AController : UIViewController  <BControllerDelegate>
    

    In the AController.m file, add this:

    //add this line before presenting the modal view controller B
    bController.delegate = self;  // assuming bController is the name of the modal
    
    -(void)dismissMe
    {
        //call back from modal view to dismiss it
        [self dismissModalViewControllerAnimated:YES];
    }
    
    0 讨论(0)
提交回复
热议问题