Objective c 如何将单元格accessoryType设置为字符串,IOS
我的一些tableview单元格有箭头, 我把箭放在旁边 cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator 但在其中一个表视图单元格中,我想显示一个简单的字符串或文本,而不是箭头Objective c 如何将单元格accessoryType设置为字符串,IOS,objective-c,ios,string,uitableview,Objective C,Ios,String,Uitableview,我的一些tableview单元格有箭头, 我把箭放在旁边 cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator 但在其中一个表视图单元格中,我想显示一个简单的字符串或文本,而不是箭头 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexP
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell.textLabel.text isEqualToString:@"Version"]){
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
如何在tableview单元格的最右侧显示字符串?您可以将self.accessoryView设置为任何UIView,例如使用文本创建的UILabel,而不是设置cell.accessoryType。使用单元格的accessoryView属性:
UILabel * disclosureLabel = //create your UILabel
cell.accessoryView = disclosureLabel;
[disclosureLabel release];