My login view has a subview which has a UIActivityView
and a UILabel
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?
My login view has a subview which has a UIActivityView
and a UILabel
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?
A different approach than the one Ed Marty did:
You need the setMasksToBounds for it to load all the objects from IB... i got a problem where my view got rounded, but did not have the objects from IB :/
this fixed it =D hope it helps!
Swift 4 - Using IBDesignable
You can also use the User Defined Runtime Attributes feature of interface builder to set the key path
layer.cornerRadius
to a value. Make sure you include theQuartzCore
library though.This trick also works for setting layer.borderWidth however it will not work for
layer.borderColor
as this expects aCGColor
not aUIColor
.You will not be able to see the effects in the storyboard because these parameters are evaluated at runtime.
You need to first import header file
<QuartzCore/QuartzCore.h>
Don't miss to use -
setMasksToBounds
, otherwise the effect may not be shown.