1

This is the code I am using for the UILabel title of my View Controller:

UIFont *bebasFont = [UIFont fontWithName:@"Bebas" size:100]; RestaurantsTitle.font = bebasFont; RestaurantsTitle.text = @"RESTAURANTS";

and I need to enlarge the space between the letters of the title but I don't know how to do it.

Setting a width to the text field and not the frame would also work if that is also possible?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189

1 Answers1

1

I need to enlarge the space between the letters

Use NSAttributedString and increase the kerning of the string.

https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSAttributedString_Class/index.html

https://developer.apple.com/library/ios/documentation/UIKit/Reference/NSAttributedString_UIKit_Additions/index.html#//apple_ref/doc/c_ref/NSKernAttributeName

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Example code from my book here: https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/iOS7bookExamples/bk2ch10p503attributedString/ch23p771attributedStringInLabel/ViewController.m – matt Jan 25 '15 at 22:11
  • Than you so so much! I will figure it out with what you gave me :) – Stella Nguyen Jan 25 '15 at 22:20