码迷,mamicode.com
首页 > 编程语言 > 详细

swift 2.2 NO.6 -class v

时间:2016-03-05 23:27:25      阅读:197      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!