presentModalViewControllerAnimated 和 dismissModalViewControllerAnimated

来源:互联网 发布:空间数据质量国家标准 编辑:程序博客网 时间:2024/05/28 01:35

转自http://blog.163.com/youthpasses@yeah/blog/static/161849228201251905220964/

presentModalViewControllerAnimated 和 dismissModalViewControllerAnimated  

使用presentModalViewControllerAnimated方法从A->B->C,若想在C中直接返回A,则可这样实现:

C中返回事件:

  • void back  
  • {  
  •       [self dismissModalViewControllerAnimated:NO];//注意一定是NO!!  
  •       [[NSNotificationCenter  defaultCenter]postNotificationName:@"backback" object:nil];  
  • }

    然后在B中,

    1. //在viewdidload中:  
    2. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(back) name:@"backback" object:nil];  
    3.   
    4. -(void)back  
    5. {  
    6.      [self dismissModalViewControllerAnimated:YES];  
  • 原创粉丝点击