简体   繁体   中英

Corner radius for UIButton not working after upgrading to Xcode 8

I am setting the corner radius of UIButton as follows:

self.btnFBLogin.layer.cornerRadius = self.btnFBLogin.frame.size.height/2;
self.btnFBLogin.layer.masksToBounds = YES;

However, after upgrading to Xcode 8 it is not working. Button is not displayed in screen. However, if I do not set the corner radius it displays as a square box. Has anybody faced similar issue?

In all probability you are running that code too soon (eg viewDidLoad ). Do it in, say, viewDidLayoutSubviews .

Try This

Make Clip Subviews checked

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM