IOS-ViewController与Storyboard进行绑定-Swift

在IOS中,新建项目时默认有一个Main.storyboard和ViewController,这两个是默认绑定的。

但是如果自己新建了ViewCOntroller与storyboard文件,想将两者绑定起来,那就可以这样:

1、选中storyboard文件,将其class设置为自己新建的ViewController,并设置Storyboard ID

2、实现页面跳转

在某个点击事件中实现页面跳转

swift 复制代码
		let test=UIStoryboard(name: "Test", bundle: nil)
        let test_vc=test.instantiateViewController(identifier: "test")
        self.present(test_vc, animated: true)

3、做绑定测试

在Storyboard中拉出一个按钮,并设置引用,拿到引用修改按钮标题

4、结果

相关推荐
初级代码游戏2 天前
easy Photo Clean公测版:快速清理iPhone照片 邀请公测
ios·iphone
库奇噜啦呼2 天前
【iOS】RunLoop学习
学习·ios
影寂ldy2 天前
WinForm PictureBox控件 + ImageList组件 完整笔记
开发语言·笔记·swift
黑科技iOS上架2 天前
iOS应用周末提交什么情况算卡审
经验分享·ios
zzb15802 天前
ios基础-MVC-UIView
ios·mvc·cocoa
kingbal2 天前
Flutter:Flutter SDK版本管理工具FVM
android·flutter·ios·android-studio·window
他们都不看好你,偏偏你最不争气3 天前
【iOS】Runtime - Part 2 && 消息发送:缓存、查找与转发
macos·ios·objective-c·cocoa
Deepzz3 天前
macOS 上调教第三方鼠标的一些经验:从滚动顺滑到输入法自动切换
macos·swift·鼠标
2501_915918413 天前
iOS App性能测试工具的实现方法与优化循环指南
android·ios·小程序·https·uni-app·iphone·webview