美文网首页
ios UIViewController 界面跳转

ios UIViewController 界面跳转

作者: 大白_帕克 | 来源:发表于2018-10-31 20:09 被阅读0次

    方法一:
    跳转到下一个界面:PresentViewController

    //触摸屏幕的响应事件 调用方法 touch
    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
        NextViewController *nextVc = [[NextViewController alloc]init];//初始化下一个界面
        [self presentViewController:nextVc animated:YES completion:nil];//跳转到下一个界面
    }
    

    返回上一个界面:dismissViewControllerAnimated

    /触摸屏幕响应事件
    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
        [self dismissViewControllerAnimated:YES completion:nil];//返回上一页面
    }
    

    相关文章

      网友评论

          本文标题:ios UIViewController 界面跳转

          本文链接:https://www.haomeiwen.com/subject/pkhztqtx.html