Swift Playground
发布时间:2020-12-14 01:30:07 所属栏目:百科 来源:网络整理
导读://: Playground - noun: a place where people can play// 让开发和 '玩' 一样/*左边: 代码区右边: 运行结果显示区无需编译 直接看到开发效果作用: 方便初学者迅速演练 方便测试代码*//*语法:初始化 OC alloc / initWithXXX alloc / init Swift 类名(XXX:) (
//: Playground - noun: a place where people can play // 让开发和 '玩' 一样 /* 左边: 代码区 右边: 运行结果显示区 无需编译 直接看到开发效果 作用: 方便初学者迅速演练 方便测试代码 */ /* 语法: 初始化 OC alloc / initWithXXX alloc / init Swift 类名(XXX:) () 方法调用 点语法调用方法 OC: [UIColor redColor]; swift: UIColor.redColor 枚举: OC: UIButtonTypeContactAdd Swfit: . 分开 快捷实用 选中枚举 -> enter -> 右键 -> . -> 选择枚举 枚举 . 前半部分可以省略 注意 省略前半部分枚举可能没有只能提示 swift语言 更加的简洁 */ import UIKit var str = "Hello,playground" let v = UIView(frame: CGRectMake(0,100,100)) v.backgroundColor = UIColor.redColor() let btn = UIButton(type: .ContactAdd) btn.center = v.center v.addSubview(btn) //let image = UIImage(named: "xxxx") (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |