2015. 8. 23.

Rounded square button in swift ( customizing shape and color in code)


override func viewDidLoad() {
        super.viewDidLoad()

     let TAG_BTN = 1001  // it is assigned to button which you want to change properties.
     let btn : UIButton  = self.view.viewWithTag(TAG_BTN) as! UIButton
     btn.layer.cornerRadius = 5
     btn.layer.borderColor = UIColor.grayColor().CGColor
     btn.layer.borderWidth = 1.5

     btn.backgroundColor = UIColor(red: 1.0, green: 0, blue: 0, alpha: 1)
}



댓글 없음:

댓글 쓰기