I've been drawing my circles using Core Graphics, but I have recently started implementing xibs using the interface builder for my views. Is there anyway to draw a circle using the interface builder? Surprisingly, I couldn't find any other thread answering this question even though it sounds like a simple one.
There isn't per-se, but you can achieve this effect using a view's corner radius. This is performance-heavy however, so you should test on different devices and see the performance implications of this.
Xcode provides a "User Defined Runtime Attributes" section:
The format of this is key path and value.
You could set the layer.cornerRadius
keypath to half the width/height of the view. To help with performance, you can set the layer.shouldRasterize
key path to YES
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With