我想要将表格单元格标签中的所有字母转换为大写字母,使用的是 NSString
。
这是我的代码:
// cell title and subtitle
cell.nameLabel.text = listingNode.title;
[cell.nameLabel.text uppercaseString];
似乎完全没有任何影响。
我想要将表格单元格标签中的所有字母转换为大写字母,使用的是 NSString
。
这是我的代码:
// cell title and subtitle
cell.nameLabel.text = listingNode.title;
[cell.nameLabel.text uppercaseString];
似乎完全没有任何影响。
uppercaseString
方法返回接收者的大写表示形式。这意味着您需要收集返回的字符串并将其应用于标签作为文本。
尝试这个:
NSString *uppercase = [cell.nameLabel.text uppercaseString];
cell.nameLabel.text = uppercase;
NSString * str=@"jit";
NSLog(@"%@",[str uppercaseString]);
cell.nameLabel.text=[str uppercaseString];
您只需将字符串转换为大写即可。
cell.nameLabel.text=[String_name uppercaseString];
cell.nameLabel.text = [listingNode.title uppercaseString];
uppercaseString返回一个值 - 包含操作结果的NSString。
cell.nameLabel.text = [listingNode.title uppercaseString];