您的位置:首页 > 移动开发 > Swift

swift创建button、label、imgview、以及添加手势与动画

2017-06-21 16:53 1116 查看
试试用swift创建UI、可以看看,swift还是简单,慢慢学习

import UIKit

let a = 1

let label = UILabel()

class ViewController: UIViewController {

    let b =
2

    

    override
func viewDidLoad() {

        super.viewDidLoad()

        

        //1、创建一个view

        let bgView =
UIView(frame:CGRect(x:0,y:0,width:375,height:667))

        bgView.backgroundColor =
UIColor.red;

        //bgView.isHidden = true

        self.view.addSubview(bgView)

        

        //2、创建button

        /*

         UIButtonType.system:前面不带图标,默认文字颜色为蓝色,有触摸时的高亮效果

         UIButtonType.custom:定制按钮,前面不带图标,默认文字颜色为白色,无触摸时的高亮效果

         UIButtonType.contactAdd:前面带“+”图标按钮,默认文字颜色为蓝色,有触摸时的高亮效果

         UIButtonType.detailDisclosure:前面带“!”图标按钮,默认文字颜色为蓝色,有触摸时的高亮效果

         UIButtonType.infoDark:为感叹号“!”圆形按钮

         UIButtonType.infoLight:为感叹号“!”圆形按钮

        */

        let
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS swift