let button = UIButton.init(frame: CGRectMake(, , , ))
button.setTitle("按钮", forState: UIControlState.Normal)
button.backgroundColor = UIColor.redColor()
button.addTarget(self, action:#selector(buttonClick), forControlEvents: UIControlEvents.TouchUpInside)
button.setTitleColor(UIColor.grayColor(), forState: UIControlState.Normal)
self.view.addSubview(button) //点击事件
func buttonClick(){
print("点击")
}