目录

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、结果

本文是转载文章,点击查看原文
如有侵权,请联系 xyy@jishuzhan.net 删除
相关推荐
WDeLiang10 小时前
Flutter 环境搭建
flutter·ios·visual studio code
lilili啊啊啊18 小时前
iOS 应用性能测试工具对比:Xcode Instruments、克魔助手与性能狗
测试工具·ios·iphone·xcode·克魔
264玫瑰资源库1 天前
嘻游电玩三端客户端部署实战:PC + Android + iOS 环境全覆盖教程
android·ios
鸿蒙布道师1 天前
鸿蒙NEXT开发权限工具类(申请授权相关)(ArkTs)
android·ios·华为·harmonyos·arkts·鸿蒙系统·huawei
鸿蒙布道师1 天前
鸿蒙NEXT开发定位工具类 (WGS-84坐标系)(ArkTs)
android·ios·华为·harmonyos·arkts·鸿蒙系统·huawei
ghhgy5312 天前
已安装爱思助手和Apple相关驱动,但仍无法有线连接iPhone热点,且网络适配器没有Apple Mobile Device Ethernet,问题解决
ios·iphone
陈皮话梅糖@2 天前
iOS error: some files could not be transferred (code 23) at xxx
ios
林晨月2 天前
SwiftUI Color(一)
ios·swiftui
Andy3222 天前
030 期 3个神器让你的Mac更聪明!
ios·github·mac
iOS阿玮2 天前
“社交类的天塌了!”不是夸夸其谈而是确有其事!
ios·app·apple