加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

(二)swift TabbedApplication 内增加普通视图

发布时间:2020-12-14 01:36:36 所属栏目:百科 来源:网络整理
导读:Tab Bar Controller 新增一个 Item (UIViewController) 单击选择 Main.storyboard ,Xcode 右下角 输入“UIviewController” 拖拽 第一个选项,放置于中央编辑区域。 Control+鼠标左键 建立Relationship ,弹出框内,选择 Relationship Segue - view contr

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”

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读