Skip to content

SmallSharpToolsOpenSource/CircleButton

Repository files navigation

Circle Button

Easy way to create buttons masked in a circle with colored border without the anti-aliasing distortion

When setting the corner radius, border color and border width there is often bleeding through to the edges as is seen with the screenshot from the StackOverflow question below. This approach eliminates the bleeding by embedding the masked view without a superview which can also be made circular.

This approach works well with a Storyboard by simply setting the class to SSTCircleButton or SSTCircleView with the superview class set to SSTCircleWrapperView. The background color of the superview is used as the border color and the distance between the superview and the wrapped view is used for the border width.

StackOverflow Question

Usage

To run the example project; clone the repo, and run pod install from the Example directory first.

CocoaPods

CircleButton is available through CocoaPods, to install it simply add the following line to your Podfile:

pod 'CircleButton', '~> 1.1'

or

pod 'CircleButton', :git => 'https://github.com/brennanMKE/CircleButton.git', :tag => '1.1.1'

Photo Credit

License

CircleButton is available under the MIT license. See the LICENSE file for more info.

Contact

Brennan Stehling
SmallSharpTools
@smallsharptools (Twitter)

About

Easy way to create buttons masked in a circle with colored border without the anti-aliasing distortion

Resources

License

Stars

Watchers

Forks

Packages

No packages published