Change Cell Accessory Type?
I have a tableview called "AllOne.h" with cells that are all subtitle
style cells with a disclosure indicator. The subtitle text is generated
dynamically, so it's pretty likely each cell will have different subtitle
text. I have an if statement that says if the text = "hello, world", then
it changes accessory type to detaildisclosureindicator. When the
detaildisclosureindicator is pressed, it pushes a new controller, changes
the subtitle text, then pops that view controller and returns to
"allone.h". The problem is, it still shows the detaildisclosureindicator
even if the text != "hello, world". I tried changing the style in
viewWillAppear, but I don't have access to cell. Here is my code.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//populate cells with stuff
if(cell.detailTextLabel.text isEqualToString:@"hello, world"){
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
}
So I guess my question is, how do I change the accessory type back once I
return to "allone.h" and the cell's text is no longer "hello, world"?
No comments:
Post a Comment