Trying to use a different font and font size on TabelViewCell, but does not work.
Here is what I tried:
cell.textLabel.attributedText = [infoCells objectAtIndex:indexPath.row];
This code crashes the application
Then I tried this:
cell.textLabel.text = [infoCells objectAtIndex:indexPath.row];
Now everything works, but the font and font size do not change.
Here is another code from my application:
- (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];
cell.textLabel.attributedText = [infoCells objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont fontWithName:@"Adobe Arabic" size:20];
return cell;
}
source
share