Xcode interface builder: Static table view cell font is not being set

I am trying to set the font of static table view cells, using Interface Builder. I added all the cells visually using interface builder. Now I want to change the font of the table view cells.

First, I tried selecting the label of each cell and changing it to attributed text, and I set the font. Even the preview is showing the correct font, but the simulator still shows the normal font.

Then I kept it as a plain label, but changed the font from there. Still, the Interface Builder shows the correct font. But the results show otherwise.

So what do I do? It'll be a hassle to create an array, create a bunch of segues, and use the cellForRowAtIndexPath function. Maybe there's a better way? Thank you.

Answers


You should use following method willDisplayCell to set custom fonts of the table cell:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{

cell.textLabel.textColor=[UIColor whiteColor];
cell.detailTextLabel.font=[UIFont fontWithName:@"Helvetica" size:16.0];
cell.detailTextLabel.textColor=[UIColor blueColor];
}

because your changes will be lost when the cell is actually displayed using xib file or using cellForRowAtIndexPath method.

follow this LINK and LINK


Need Your Help

how to create an IPA file having the UDID of the device and not the actual device

ios5 ipa udid archiving

I have the capability of archiving and getting an IPA file if i have the device connected to the Mac. But now i need to create an IPA file and send it over seas...I have the device's UDID how can i

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.