swift实现页面跳转(下一页以及返回)

swift实现页面跳转(下一页以及返回)

拖拽一个view controller

建立两个新的swift文件,命名为FirstPage和SecondPage

修改两个view controller的继承的类
修改

拖拽添加两个button

右键拖拽首页的button到第二页,在弹出的窗口中选择show

右键拖拽下一页的button到SecondPageViewController.swift中,添加action方法

在方法中添加代码

@IBAction func backClicked(_ sender: UIButton) {
    self.dismiss(animated: true, completion: nil)
}

猜你喜欢

转载自blog.csdn.net/lc326514244/article/details/69808670