itsaboutcode itsaboutcode - 1 year ago 118
iOS Question

Giving UIView rounded corners

My login view has a subview which has a

and a
saying "Signing In…". This subview has corners which aren't rounded. How can I make them round?

Is there any way to do it inside my xib?

Answer Source

Try this

#import <QuartzCore/QuartzCore.h>


view.layer.cornerRadius = 5;
view.layer.masksToBounds = YES;

Note: If you are trying to apply rounded corners to a UIViewController's view, it should not be applied in the view controller's constructor, but rather in -viewDidLoad, after view is actually instantiated.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download