Tab Bar Controller 新增一个 Item (UIViewController)
单击选择 Main.storyboard ,Xcode 右下角 输入“UIviewController” 拖拽 第一个选项,放置于中央编辑区域。
Control+鼠标左键 建立Relationship ,弹出框内,选择 Relationship Segue -> view controllers
为这个新建UIviewController 建立一个controller
1、Myoa 右键 –> New File… -
2、弹出窗口 IOS -> Source ->右侧选择 Swift File
Save As: 填入ThirdViewController,然后点击Create
import UIKit
class ThirdViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print("Third")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
3、选择 Main.storyboard,选择新建的 Item
在右侧Class处选择 ThirdViewController
Module选择“CompanyOA”
4、项目运行
单击左上角启动按钮,项目启动后,点击项目的第三项。
底部All Output窗口输出:”Third”
本文详细介绍如何在Swift项目中使用Xcode通过Interface Builder向TabBarController中添加新的ViewController,并实现对应的视图控制器类。
swift TabbedApplication 内增加普通视图&spm=1001.2101.3001.5002&articleId=50095285&d=1&t=3&u=8cd9f92e63de4da9a8deb5632edc065f)
4416

被折叠的 条评论
为什么被折叠?



