APRoundedButton is a simple XIB/Storyboard extension to make rounded custom buttons, without writing one line of code, now using IBInspectable.
What are IBInspectable?
IBInspectable properties provide new access to an old feature: user-defined runtime attributes.
Currently accessible from the identity inspector, these attributes have been available since before
Interface Builder was integrated into Xcode.
They provide a powerful mechanism for configuring any key-value coded property of an instance in a NIB, XIB, or storyboard.
How to use
- iOS 7+
- Xcode 5
Copy in your project the files:
and add QuartzCore framework.
- Open your XIB or Storyboard
- Draw a UIButton
- Change the default class to APRoundedButton
- Corner TOP LEFT
- Corner TOP RIGTH
- Corner BOTTOM LEFT
- Corner BOTTOM RIGTH
- Corner RADIUS
- BUTTON COLOR
You should see “Rounded Button” options.
…try to change and you see in realtime the preview of your corners!
Build and run. That’s all!
No one line of code is needed!
The old one article “UIButton with rounded corners” do the same thing but usingUser-defined Runtime Attributes.
Want Android version?