With the help of MaterialDesignIconicFont we can use icons as texts and set them on label or title of buttons etc.
To include the font first download the attached Material-Design-Iconic-Font.ttf file at the bottom of this blog.
Now drag and drop or using add files add the file to you xcode project.
In the info.plist add entry with key Fonts provided by application.
In this entry add "Material-Design-Iconic-Font.ttf"
Now we can use it on storyboard by selecting from custom fonts list like below
To set the title or text select the icon text from this link
To select the icon text first go to the link and search for the icon. Then click on the icon and a pop up will appear.
Select the icon and copy and then paste the icon in the title (or text) field in the attributes inspector. It will show a character with question mark in the attributes inspector but will show the correct icon on storyboard.
The font can also be used programmatically like normal fonts. Use it like this :
[button.titleLabel setFont:[UIFont fontWithName:@"MaterialDesignIconicFont" size:22]]
0 Comment(s)