2

I'm not able to change the textLabel's font in UITableViewCell. This line doesn't work with iOS 8 SDK : [cell.textLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:16.5]];

Can anyone give help me ?

EDIT : My app run with iOS7. I want to test it with iOS8. Only this line of code doesn't work.

6
  • What's the error you get?
    – Tim
    Commented Jun 3, 2014 at 9:02
  • please do autoresizeing uncheck in your nib file
    – Rohit
    Commented Jun 3, 2014 at 9:23
  • 1
    that won't work as it's Obj-C syntax. Look at the swift guide on Devleoper site. iOS 8 is still under NDA
    – CW0007007
    Commented Jun 3, 2014 at 9:32
  • @Jeff They was no error. The simulator doesn't take this line in account.
    – Mindsers
    Commented Jun 3, 2014 at 13:33
  • @Rohit I don't use nib file.
    – Mindsers
    Commented Jun 3, 2014 at 13:33

3 Answers 3

4

I find the solution. This line:

[cell.textLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:16.5]];

change to this line :

[[cell textLabel] setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size: 16.5]];

This is the only change I made in my code.

0

I'm not familiar with xCode6, but you should check if the file is set to objective-c.

1
  • Yes, it is. "Default - Objective-C Sources"
    – Mindsers
    Commented Jun 3, 2014 at 13:42
0

I had the same problem and was able to resolve it. try opening your ttf file in the font book application and validate it. if you get a red X in one of the validation steps that might be the issue. I replaced the ttf with a file from a different font and the problem was resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.