Pomimo, iż nowy na iOS programowo ing, napotkałem ten sam problem bardzo szybko. W iOS, moje doświadczenie jest to, że problemem
- Lewis42 za występuje konsekwentnie sugestię
- Josefa wydobycia i ponownego ubiegania atrybuty nie nie działa: atrybuty null słownika jest zwracana.
Po rozejrzał S/O, natknąłem This Post a następnie to zalecenie, skończyło się za pomocą tego:
- (NSMutableAttributedString *)SetLabelAttributes:(NSString *)input col:(UIColor *)col size:(Size)size {
NSMutableAttributedString *labelAttributes = [[NSMutableAttributedString alloc] initWithString:input];
UIFont *font=[UIFont fontWithName:@"Helvetica Neue" size:size];
NSMutableParagraphStyle* style = [NSMutableParagraphStyle new];
style.alignment = NSTextAlignmentCenter;
[labelAttributes addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, labelAttributes.length)];
[labelAttributes addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, labelAttributes.length)];
[labelAttributes addAttribute:NSForegroundColorAttributeName value:col range:NSMakeRange(0, labelAttributes.length)];
return labelAttributes;
Właściwie iOS powinien zrobić to domyślnie, w każdym razie mamy naszą drogę. Dzięki, Twoja sugestia pomogła mi. –