如題,
需要讓標簽中單詞的第一個字母大寫:
UILabel *lbl4=[[UILabel alloc]initWithFrame:CGRectMake(10, 90, 200, 30)];
lbl4.text= [NSString stringWithFormat:@"(%@)", [arrtype objectAtIndex:0]];
lbl4.font = [UIFont fontWithName:@"Helvetica" size:18];
lbl4.textColor=[UIColor blackColor];
lbl4.backgroundColor=[UIColor clearColor];
不知道哪裡出錯了,謝謝
找到答案了,大寫應該是設置在字符串的。
[NSString capitalizedString]
將字符串大寫,然後將它設置到標簽的文本中
lbl4.text= [[NSString stringWithFormat:@"(%@)", [arrtype objectAtIndex:0]]capitalizedString];