【swift系列之UIButton】簡單使用
阿新 • • 發佈:2019-01-08
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() }