UI_模态页面跳转

前一页建立跳转事件

    // 添加左边导航栏按钮
    UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(leftButtonAction:)];

    self.navigationItem.leftBarButtonItem = leftButton;
#pragma mark - 导航栏左边按钮实现
- (void)leftButtonAction:(UIBarButtonItem *)sender
{
    // 模拟推出页面,被推出的页面
    AddViewController *addVC = [[AddViewController alloc] init];
    [self presentViewController:addVC animated:YES completion:nil];

}

后一页跳转回来

    // 添加点击事件
    [self.rootView.cancleButton addTarget:self action:@selector(cancleButtonDidClickde:) forControlEvents:UIControlEventTouchUpInside];
// 实现点击事件
- (void)cancleButtonDidClickde:(UIButton *)sender
{
    // 跳到前一页
    [self dismissViewControllerAnimated:YES completion:nil];
}

你可能感兴趣的:(UI,事件,按钮,页面模态跳转)