ios - modal view controller not calling presenting view controller's dismissModalViewControllerAnimated: method -
ios - modal view controller not calling presenting view controller's dismissModalViewControllerAnimated: method -
in modal view controller have button handling method includes
[self dismissmodalviewcontrolleranimated: yes];
in presenting view controller override dismissmodalviewcontrolleranimated: follows:
-(void) dismissmodalviewcontrolleranimated: (bool)animated { nslog(@"dismiss"); [super dismissmodalviewcontrolleranimated: animated]; }
when button touched, button handling method gets called, dismissmodalviewcontrolleranimated: override not seem called: nslog(@"dismiss"); statement isn't called, , breakpoint within method doesn't hit.
i tried
[[self presentingviewcontroller] dismissmodalviewcontrolleranimated: yes];
but didn't work either. however, modal view controller dismissed.
any thought might going wrong?
this handled declaring presenting view controller delegate modal view controller. modal vc called delegate method in presenting vc dismiss modal transition created.
example:
modal vc.h:
@protocol modalviewcontrollerdelegate -(void)dismissmymodalviewcontroller; @end
modal vc.m:
// when want dismiss modal vc [delegate dismissmymodalviewcontroller];
presenting vc.h:
// create sure #import modalvc.h @property (nonatomic, retain) id <modalviewcontrollerdelegate> delegate;
presenting vc.m:
-(void)dismissmymodalviewcontroller { [self dismissmodalviewcontrolleranimated:yes]; }
ios uiviewcontroller uikit modal-dialog
Comments
Post a Comment