trying to use a different font and font size on TabelViewCell but its not working.
Here is what I tried:
cell.textLabel.attributedText = [infoCells objectAtIndex:indexPath.row];
This code makes the app crash
Then i tried this:
cell.textLabel.text = [infoCells objectAtIndex:indexPath.row];
Now everything works but the font and the font size does not change.
Here are some more code from my app:
- (void)viewDidLoad
{
[super viewDidLoad];
infoCells = [[NSMutableArray alloc] initWithCapacity:2];
[infoCells addObject:@"DOI"];
[infoCells addObject:@"WIS?"];
[infoCells addObject:@"اللَّهُمَّ إِنِّي أَسْتَخِيرُكَ بِعِلْمِكَ وَأَسْتَقْدِرُكَ بِقُدْرَتِكَ"];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
cell.textLabel.attributedText = [infoCells objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont fontWithName:@"Adobe Arabic" size:20];
return cell;
}
You need to make a NSMutableAttributedString string and then assign it. So for more info see in this example.