【swift系列之UIButton】简单使用

前端之家收集整理的这篇文章主要介绍了【swift系列之UIButton】简单使用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
override func viewDidLoad() {
        super.viewDidLoad()

        let button = UIButton.buttonWithType(UIButtonType.System) as! UIButton
        button.frame = CGRectMake(100,100,80,50)
        button.backgroundColor = UIColor.orangeColor()
        button.setTitle("选照片",forState: UIControlState.Normal)
        button.addTarget(self,action: "clickBtn:",forControlEvents: UIControlEvents.TouchUpInside)
        self.view.addSubview(button)
    }
    func clickBtn(sender:UIButton){
        self.fromAlbum()
    }
原文链接:https://www.f2er.com/swift/326977.html

猜你在找的Swift相关文章