Tulon
Tulon

Reputation: 4124

How to use different font name in UITableViewCell UILabel

I want to use different Font name in a UILable in UITableViewCell. I try with a lot of examples like:

    Cell.cellSectionLabel.text = [self.textsInTableSection objectAtIndex:0];
    Cell.cellSectionImageView.image = [UIImage imageNamed:[self.imagesInTableSection objectAtIndex:0]];
    Cell.cellSectionLabel.textColor = [UIColor colorWithRed:59.0f/255.0f green:56.0f/255.0f blue:62.0f/255.0f alpha:1.0f];
    [Cell.cellSectionLabel setFont:[UIFont fontWithName:@"Helvetica" size:16]];
    Cell.cellSectionLabel.font = [UIFont systemFontOfSize:16];

in cellForRowAtIndexPath

It is not working. The Font name actually read the default Font of my device. Because if I use some different Font name here [Cell.cellSectionLabel setFont:[UIFont fontWithName:@"Baskerville" size:16]];, it doesn't change any thing. It remain the same. How can I use different font name in this case?

Thanks a lot in advance.

Upvotes: 0

Views: 207

Answers (2)

Suraj Mirajkar
Suraj Mirajkar

Reputation: 1401

Please remove the last line of your code and try again.
Cell.cellSectionLabel.font = [UIFont systemFontOfSize:16];

According to your code you are setting font to Helvetica 16 
& again changing it back to System font

Upvotes: 0

Levi
Levi

Reputation: 7343

You are setting it back to the system font. Delete this line:

Cell.cellSectionLabel.font = [UIFont systemFontOfSize:16];

Upvotes: 1

Related Questions