Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 标签在我的表格单元格中_Iphone_Objective C_Cocoa Touch_Uilabel - Fatal编程技术网

Iphone 标签在我的表格单元格中

Iphone 标签在我的表格单元格中,iphone,objective-c,cocoa-touch,uilabel,Iphone,Objective C,Cocoa Touch,Uilabel,可能重复: 感谢您的快速反馈 但这对我不起作用,我正在使用表中的标签 UILabel *label1 = (UILabel *) [cell viewWithTag:1]; label1.backgroundColor = [UIColor clearColor]; label1.text=aStation.station_name; label1.textColor = [UIColor colorWithRed:0.76 green:0.21 blue:0.07 alpha:1.0]; [

可能重复:

感谢您的快速反馈 但这对我不起作用,我正在使用表中的标签

UILabel *label1 = (UILabel *) [cell viewWithTag:1];
label1.backgroundColor = [UIColor clearColor];
label1.text=aStation.station_name;
label1.textColor = [UIColor colorWithRed:0.76 green:0.21 blue:0.07 alpha:1.0];
[label1 setFont:[UIFont fontWithName:@"Trebuchet MS" size:15]];  
对于这种类型的标签,我想限制字符数。
希望我能得到答案。

您可以控制分配给文本字段时在标签中输入的字符数。如果标签中的文字太多,可以缩短文字。你能更好地描述这个问题吗?什么不起作用?它做了什么错了?hi-lak,请只发布一次你的问题。如果你没有得到一个好的答案,你可以编辑和添加更多的信息或澄清你的问题。
NSString *myString = [self getStringValue];  // Set the value any way you like.
int maxLen = 10;  // Or whatever your true maximum length is.
label.text = myString;
if (([myString length] > maxLen) label.text = [myString substringToIndex:maxLen];