微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

二swift TabbedApplication 内增加普通视图

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”

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐