Swift基础笔记11/27
来源:互联网 发布:河南郑州网络诈骗6.29 编辑:程序博客网 时间:2024/06/03 22:59
一、导航条
self.window = UIWindow(frame: UIScreen.mainScreen().bounds) self.window!.makeKeyAndVisible() self.window!.backgroundColor = UIColor.whiteColor() let viewController = ViewController() let nav = UINavigationController(rootViewController: viewController) self.window!.rootViewController = nav nav.navigationBar.translucent = false
二、初始化View
var shuxingLabel:UILabel! override init(frame: CGRect) { super.init(frame: frame) } required init(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
三、代理传值
在传值页面
protocol SendProtocol{ func sendData(str:String)}
var delegate:SendProtocol!
self.delegate.sendData(textField.text)在取值页面
class FirstViewController: UIViewController, SendProtocol{
func sendData(str: String) { label.text = str }
四、通知
NSNotificationCenter.defaultCenter().postNotificationName("notification", object: textField.text)
println("notofication") NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("change:"), name: "notification", object: nil)
<pre name="code" class="objc">unc change(notification:NSNotification){ println("change") label.text = "\(notification.object!)" label.text = String(stringInterpolationSegment: notification.object!) }
0 0
- Swift基础笔记11/27
- swift基础知识点笔记
- swift笔记-基础部分
- Swift 2.2 基础笔记
- swift笔记--基础(一)
- swift笔记--基础(二)
- 【Swift基础】Swift 4.0学习笔记
- Swift 学习笔记之基础
- swift-学习笔记一《基础》
- swift之基础语法笔记
- swift基础笔记5-属性
- swift 笔记(一)—— 基础
- Swift学习笔记一(基础部分)
- Swift随堂笔记之基础版
- Swift学习笔记(一)基础操作
- Swift学习笔记基础语法-整数类型
- Swift学习笔记——基础语法
- Swift基础学习笔记一(对比OC)
- 【分享】一个语音Java SDK使用的常见问题解答
- 第十五节 BLE蓝牙4.0协议栈启动分析
- 用jconsole可视化JVM的运行状态
- 优化算法-梯度下降法
- C++:使用vector的元素
- Swift基础笔记11/27
- bootstrap 左侧横向选项卡
- iOS 百度地图-绘制行车路径
- Linux下php-fpm安装配置
- 创建线程的三种方式
- Android 4.2 状态栏添加图标
- 【Android】【超简单】让你学会相机拍照,相册选图,OOM处理等
- 手机端六位密码输入框
- Linux grep 命令