Level up ionicons-iOS with a category

Purpose

Ionicons is a cool icon font framework (100% free and open source) designed by Ionic Framework .

David Sweetman released an iOS library to permit iOS developers to integrate this font with your projects via this repository https://github.com/sweetmandm/ionicons-iOS

But you can only generate UIImage object or UILabel with this library. I needed more like generate UIImageView , UIButton , add a corner radius around them […].

So i created a category who is now adding useful functions.

Category overview

OBJECTIVE-C
+ (UIButton*) buttonWithIcon:(NSString*)icon_name
                          iconColor:(UIColor*)iconColor
                           iconSize:(CGFloat)iconSize
                          imageSize:(CGSize)imageSize;

+ (UIButton*) roundedButtonWithIcon:(NSString*)icon_name
                iconColor:(UIColor*)iconColor
                 iconSize:(CGFloat)iconSize
                imageSize:(CGSize)imageSize;

+ (UIImageView*) imageViewWithIcon:(NSString*)icon_name
                         iconColor:(UIColor*)iconColor
                          iconSize:(CGFloat)iconSize
                         imageSize:(CGSize)imageSize;

+ (UIImageView*) roundedImageViewWithIcon:(NSString*)icon_name
                                iconColor:(UIColor*)iconColor
                                fillColor:(UIColor*)fillColor
                                 iconSize:(CGFloat)iconSize
                                imageSize:(CGSize)imageSize;

+ (UIImageView*) roundedImageViewWithIcon:(NSString*)icon_name
                               iconColor:(UIColor*)iconColor
                                iconSize:(CGFloat)iconSize
                               imageSize:(CGSize)imageSize;
Click to expand and view more

Gist

Available here . Please feel free to improve it !

More…

Quentin Rousseau

Quentin Rousseau

CTO & Co-founder at Rootly (YC S21)

San Francisco, CA

Former Instacart SRE. Rock climber & wine enthusiast.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut