UNABLE TO DISPLAY TEXT USING CELL.DETAILTEXTLABEL.TEXT

Andrew Watson

Total Post:39

Points:273
Posted by  Andrew Watson
 676  View(s)
Ratings:
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?
  1. Tarun Kumar

    Post:214

    Points:1642
    Re: Unable to display text using cell.detailTextLabel.text

    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

    reuseIdentifier:simpleTableIdentifier];

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!