0
我使用https://github.com/shamasshahid/SSRadioButtonsController添加SSRadioButtonsController單選按鈕標題。當我通過故事板添加單選按鈕,並設置職稱它工作正常,但是當我試圖通過代碼來添加單選按鈕的設置標題這是行不通的。無法從代碼
類的ViewController:UIViewController中,SSRadioButtonControllerDelegate {
VAR radioButtonController:SSRadioButtonsController?
覆蓋FUNC viewDidLoad中(){ super.viewDidLoad()
var buttonArray = [UIButton]()
let radioButton = SSRadioButton(frame: CGRect(x: 20, y: 20, width: 20, height: 20))
radioButton.circleRadius = 8
radioButton.setTitle("male", forState: .Normal)
let radioButton1 = SSRadioButton(frame: CGRect(x: 20, y: 60, width: 20, height: 20))
radioButton.circleRadius = 8
radioButton.setTitle("female", forState: .Highlighted)
self.view.addSubview(radioButton)
self.view.addSubview(radioButton1)
buttonArray.append(radioButton)
buttonArray.append(radioButton1)
radioButtonController = SSRadioButtonsController(buttons: buttonArray)
radioButtonController!.delegate = self
radioButtonController!.shouldLetDeSelect = true
// Do any additional setup after loading the view, typically from a nib.
}
func didSelectButton(aButton: UIButton?) {
print(aButton)
}
}
您的按鈕拐角半徑工作或沒有 –
是它的正常工作。 – Sahil
改變按鈕的幀,並嘗試一次... –