0

I want to use Home button with home icon, but I want to use actual font instead of graphics.

For e.g) I will set UIButton title to "H" and set Pictos font it, so that it should automatically convert button text into corresponding graphics(In this case home icon)

How to do it using pictos font?

Gaurav Borole
  • 796
  • 2
  • 13
  • 32
  • 1
    What is pictos font? Can you show your code? – Woodstock Aug 20 '14 at 06:33
  • For that you have to first install the font to that application..Plz refer http://stackoverflow.com/questions/3837965/how-to-add-custom-fonts-to-an-iphone-app ,http://stackoverflow.com/questions/21737788/custom-fonts-in-ios-7 these two answers it may help you – Albin Joseph Aug 20 '14 at 06:33
  • use custom fonts and derive UIButton class. – Shamsudheen TK Aug 20 '14 at 06:35
  • @ John Woods: Pictos font can be use as normal font like others to set icon to button. So instead of creating image and assign to button we can use this font to show different icons on button. For more details: http://pictos.cc/font/ – Gaurav Borole Aug 20 '14 at 06:35
  • @ Albin Joseph, Ramshad: Thanks will try... – Gaurav Borole Aug 20 '14 at 06:36
  • You don't need a UIButton subclass but you will need to set the font in code. Unless the betas have done this recently fonts you install through the UIAppFonts key won't show up in the IB font selectors. – Adam Eberbach Aug 20 '14 at 06:37
  • @AlbinJoseph, Ramshad, Johnwoods, Adam Eberbach: Thanks for help. Finally I got this Pictos font in Photoshop. Please see my answer for more details – Gaurav Borole Aug 20 '14 at 08:33

1 Answers1

1

Finally got "Pictos" font in .otf format from photoshop. Pictos font is available in photoshop.

Steps:

  1. Export Pictos font in .otf format from photoshop.
  2. Add custom font to your application, you can add them to the XCode project.
  3. Modify the application-info.plist file. Add the key "Fonts provided by application" to a
    new row. Add one item for pictos font you have added. enter image description here

  4. Create button and set Pictos font.

    UIButton *homeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    homeButton.frame = CGRectMake(0, 0, 34 , 33);
    [homeButton setTitle:@"H" forState:UIControlStateNormal];
    homeButton.titleLabel.font = [UIFont fontWithName:@"Pictos" size:22];
    
  5. You will see button with Home icon like enter image description here

Note: You can set different icons by setting proper title text. enter image description here

Gaurav Borole
  • 796
  • 2
  • 13
  • 32