模态视图

在导航过程中,有时候需要放弃主要任务转而做其他次要任务,然后在返回到主要任务,这个次要任务就是在 模态视图中完成的。

默认情况下,模态视图是从屏幕下方滑出来的,当完成的时候需要关闭这个模态视图,如果不关闭,就不能做其他的事情。

presentViewController:animated:completion 呈现模态视图

dismissViewControllerAnimated:completion关闭模态视图

更改StoryBoard ID:registerViewController 用于在编码中获得该视图控制器对象 

UIStoryboard* mainStoryboard = UIStoryboard storyboardWithName:@"MainStoryboard"bundle:nil

UIViewController*registerViewController = mainStoryboard*instantiateViewControllerWithIdentifier:@"registerViewController"

modalTransitionStyle属性是UIViewController类提供的,用于设定模态视图呈现和关闭时的动画效果,他们由UImodalTransitionstyle枚举中定义的常量,使用通知中心传值:1,在传值的页面发通知:2,在接收值的页面添加观察室,并实现方法

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(registerCompleteion:) name:@"RegisterCompletionNotification" object:nil];

- (void )registerCompleteion:(NSNotification*)info

{

    NSDictionary *theData = [info userInfo];

    NSString *userName = [theData objectForKey:@"username"];

    NSLog(@"<<<username %@",userName);

                             

}



        [[NSNotificationCenterdefaultCenter]postNotificationName:@"RegisterCompletionNotification"object:niluserInfo:d2

2]m ]

2


mm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值