How can I have a label on a UITableViewCell but also have an arrow on the very right side of it?
This is what I tried:
} else if(indexPath.row == 1) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50,0,200,21)];
label.text = @"Select to change code";
label.tag = 1;
label.textColor = [UIColor grayColor];
cell.accessoryView = label;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
But it’s not working. I see the label but I do not see the arrow on the very right side of the cell.
Try the following :
Hope it helps you……..
Edit: (because I can not comment. The reason for the small change is in your original code you had added the label to the cell as it’s accessoryType subView (effectively covering it with your label) whereas in the revised code, the label was correctly added as a separate subview to the cell.