当我点击tableview单元格时,它将转到下一个视图,它将显示电话和名称
switch (rowtype) {
case PhoneRow:
{
cell = [self.tableView dequeueReusableCellWithIdentifier:reusableIdentifierNormalCell];
cell.titleLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Call %@", nil), self.ecpInfo[@"Name"]];
cell.subtitleLabel.text = phoneNumber;
cell.iconImageView.image = [UIImage imageNamed:@"TelephoneIcon"];
cell.tag = ECPDetails_RowTagsStart + rowtype;
}
当我执行此行时,它显示输出就像 致电
答案 0 :(得分:0)
试试这个,
添加此宏:
#define IS_EMPTY(value) (value == (id)[NSNull null] || value == nil || ([value isKindOfClass:[NSString class]] && ([value isEqualToString:@""] || [value isEqualToString:@"<null>"]))) ? YES : NO
像这样使用:
switch (rowtype) {
case PhoneRow:
{
NSString *name = [NSString new];
if (!IS_EMPTY(self.ecpInfo[@"Name"])) {
name = self.ecpInfo[@"Name”];
}else{
name = @“”;
}
cell = [self.tableView dequeueReusableCellWithIdentifier:reusableIdentifierNormalCell];
cell.titleLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Call %@", nil), name];
cell.subtitleLabel.text = phoneNumber;
cell.iconImageView.image = [UIImage imageNamed:@"TelephoneIcon"];
cell.tag = ECPDetails_RowTagsStart + rowtype;
}