2017-08-28 41 views

回答

2

,而不是用故事板嘗試以編程方式自定義開關。嘗試使用下面的代碼,就好像你改變一個參數也必須調整開關半徑。希望它可以幫助

OnOffSwitch.layer.borderWidth = 1.0; 
OnOffSwitch.layer.cornerRadius = 16.0; 

enter image description here

OnOffSwitch.layer.borderWidth = 0.5; 
OnOffSwitch.layer.cornerRadius = 17.0; 

enter image description here