iOS开发ViewController与Swift类绑定
来源:互联网 发布:木旋全书淘宝网 编辑:程序博客网 时间:2024/06/07 20:12
在一个App中,肯定不止一个界面,所以我们在Main.storyboard中创建多个ViewController,但是我们如何来控制这个ViewController内的各种操作呢?就像Android中的一个Activity对应一个XML文件一样。在iOS中,也是一个继承自UIViewController的swift类来控制一个界面(ViewController).
(1)新建一个swift文件:File-->New-->File.选择iOS中Source中的Cocoa Touch Class。然后输入一个类名,注意:Subclass of 必须要选择UIVireController.然后就创建成功。
。
。
(2)在Main,storyboard中新建一个ViewController,打开右侧的Show the Identity inspector,在下面的Class中选择刚才新建的Swift文件MyViewController.这样就能实现界面和代码的绑定。
。
总结,经过以上几个步骤,以后就可以在对应的swift文件中操作ViewController中的控件啦。也是相当的方便。
github主页:https://github.com/chenyufeng1991 。欢迎大家访问!
1 0
- iOS开发ViewController与Swift类绑定
- Swift中ViewController类与storyboard绑定报错
- ios--swift--打开ViewController
- iOS开发点滴 - 如何通过Segue写代码传递数据从一个ViewController到另一个ViewController(Swift代码)
- iOS开发 控件不能绑定拖动到视图ViewController连接的解决方法
- iOS开发学习3:ViewController
- iOS开发之Present ViewController Modally --弹出模态ViewController
- iOS开发之Present ViewController Modally --弹出模态ViewController
- iOS开发之Present ViewController Modally --弹出模态ViewController
- Swift开发iOS项目实战视频教程(十一)---一站到底7(ViewController的生命周期函数)
- swift--ViewController.swift
- ios开发中viewcontroller之间的跳转
- iOS开发笔记1- ViewController详解
- iOS开发:ViewController生命周期方法分析
- iOS开发基础:ViewController的生命周期
- iOS开发中ViewController使用详解
- IOS ViewController
- 19、swift开发iOS——类
- RHEL十二(安装和更新软件包)
- tableView下面多余显示的Cell去除方法
- 使用Maven构建Web应用(上)
- 知识点总结(1)
- JS原生轮播(JS篇)
- iOS开发ViewController与Swift类绑定
- Windows下安装tomcat
- 其实是C++程序设计基础一周目第六天
- StartActivityforResult 的讲解转载的
- NSSortDescriptor排序(刚刚)
- 一步步优化JVM<一>:概述、方法及需求
- 空指针访问错误
- rootwrap模块解析以及功能扩展
- android 应用获取系统权限