label in my tabel celll [duplicate]

一笑奈何 提交于 2019-12-12 02:20:13

问题


Possible Duplicate:
text size in label

thank you for your fast feedback but that not worked for me i am using labels in table..

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]];  

for this type of label i want to limit number of characters. hope i will get an answer..


回答1:


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];


来源:https://stackoverflow.com/questions/3048339/label-in-my-tabel-celll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!