Level Up ionicons-iOS With a Category

| Comments

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
+ (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;

Gist

Available here. Please feel free to improve it !

More…