Home > DeveloperSection > Forums > Unable to display text using cell.detailTextLabel.text
Andrew Watson
Andrew Watson

Total Post:39

Posted on    November-17-2015 4:32 AM

 iPhone iPhone  Ios  Objective C 

 1 Reply(s)
 604  View(s)
Rate this:
I have getting problem with this code that is not displaying text in table view cell.
here is the code:.
cell.textLabel.text = [arrayObj1 objectAtIndex:indexPath.row];  
cell.detailTextLabel.text = [arrayObj2 objectAtIndex:indexPath.row]];  
NSLog(@"%@", [arrayObj1 objectAtIndex:indexPath.row]);
but, NSLog displays the value of arrayObj1, then why table view cell not displaying the text.
Please suggest me the reason, why it's not working?

Tarun Kumar

Total Post:214

Posted on    November-17-2015 11:31 PM

Table view cell provides styles for setting text label in Right and Left alignment:
These are the two styles:
UITableViewCellStyleValue1 - it will set label on the left side of the cell with left-aligned and black text, on the right side is a label that has smaller blue text and is right-aligned.
UITableViewCellStyleValue2 - it will set label on the left side of the cell with right-aligned with blue, on the right side of the cell is another label with smaller text that is left-aligned and black.

set these styles in your code like this:

UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1


Don't want to miss updates? Please click the below button!

Follow MindStick