原本:
func Hello(){
var StrongXname = UILabel(frame: CGRectMake(50,100,300,20))//Returns a rectangle with the specified coordinate and size values.
StrongXname.text = "哈咯,大家好,我叫StrongX"
self.view.addSubview(StrongXname)//Adds a view to the end of the receiver’s list of subviews.
StrongXname.alpha = 0// The view’s alpha value. where 0.0 represents totally transparent and 1.0 represents totally opaque.
var image = UIImageView(frame: CGRectMake(50, 150, 200, 270))
image.image = UIImage(named: "cute_girl.jpg")
self.view.addSubview(image)
image.alpha = 0
UIView.animateWithDuration(5, animations: { () -> Void in
StrongXname.alpha = 1
image.alpha = 1
})
}
shift+command+x后,代码对齐:
func Hello(){
var StrongXname = UILabel(frame: CGRectMake(50,100,300,20))//Returns a rectangle with the specified coordinate and size values.
StrongXname.text = "哈咯,大家好,我叫StrongX"
self.view.addSubview(StrongXname)//Adds a view to the end of the receiver’s list of subviews.
StrongXname.alpha = 0// The view’s alpha value. where 0.0 represents totally transparent and 1.0 represents totally opaque.
var image = UIImageView(frame: CGRectMake(50, 150, 200, 270))
image.image = UIImage(named: "cute_girl.jpg")
self.view.addSubview(image)
image.alpha = 0
UIView.animateWithDuration(5, animations: { () -> Void in
StrongXname.alpha = 1
image.alpha = 1
})
}