I have a uitableview w开发者_Go百科ith a searchbar as the header. when I search, the font in my table switches to the ipad default font instead of Cochin, which is the one that it was and still should be when the table is searching.
I have the following code in my willDisplayCell: method. And it is reached - I know because I put an NSLog by it, and the line prints.
UILabel *tempLbl = (UILabel *)[cell viewWithTag:1];
tempLbl.font = [UIFont fontWithName:@"Cochin" size:17];
So why, when I press the searchbar, does the text change fonts?
I'm sorry. I figured it out... I had been searching for the solution for a couple of hours and gave up and turned to stackoverflow 2 minutes before the miracle...
Despite having a custom cell with a tag to the uilabel, I was assigning the text to cell.textLabel.text = @"blah blah";
When I assigned the text to the tagged label, all was well. Sorry and thanks!
精彩评论