首页 > 编程语言 > 详细

swift 2.2 NO.6 -class v

时间:2016-03-05 23:25:59      阅读:228      评论:0      收藏:0      [点我收藏+]

import UIKit

var v = UIView(frame:CGRectMake(0,0,200, 200))

var b = UIButton(frame: CGRectMake(0, 0, 44, 44))

b.setTitle("44pix btn", forState: UIControlState.Normal)

v.addSubview(b)

////
class Animal{
var name = "default"
var age = 0
func getDetails() ->String{
return "this animals name is \(name) it is \(age) years old"
}
}

var myAnimal = Animal()
myAnimal.name = "ok"
myAnimal.age = 1
myAnimal.getDetails()

swift 2.2 NO.6 -class v

原文:http://www.cnblogs.com/yshgxm/p/5246186.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!