文章搬运来源:blog.csdn.net/Calvin_zhou…面试
做者:PGzxc(若有侵权,联系做者,当即删除)markdown
对iOS开发感兴趣,能够看一下做者的iOS交流群:812157648,你们能够在里面吹水、交流相关方面的知识,群里还有我整理的有关于面试的一些资料,欢迎你们加群,你们一块儿开车ide
-(void)presentViewCOntroller:(UIViewCOntroller *)viewCOntrollerToPresent animated:(BOOL)flag completion:(void^)completion
复制代码
self dismissViewControllerAnimated:<#(BOOL)#> completion:<#^(void)completion#>
复制代码
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeContactAdd];
btn.center=self.view.center;
[btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
-(void)btnClick{
//建立控制器对象
JumpViewController *jump=[[JumpViewController alloc]init];
//Modal出一个控制器
//[self presentModalViewController:jump animated:YES];
[self presentViewController:jump animated:YES completion:nil];
}
复制代码
- (IBAction)cancel:(UIButton *)sender {
//关闭
[self dismissViewControllerAnimated:YES completion:nil];
}
复制代码
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeContactAdd];
btn.center=self.view.center;
[btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
-(void)btnClick{
//建立控制器对象
JumpViewController *jump=[[JumpViewController alloc]init];
//Modal出一个控制器
//[self presentModalViewController:jump animated:YES];
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:jump];
[self presentViewController:nav animated:YES completion:nil];
}
复制代码
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(cancel)];
}
- (IBAction)cancel{
//关闭
[self dismissViewControllerAnimated:YES completion:nil];
}
复制代码