Today's Menu  Portugal
journal and plan nutrition
UILabel+Y5GradientFace.m
Go to the documentation of this file.
1 //
2 // UILabel+Y5GradientFace.m
3 // TodaysMenu
4 //
5 // Created by Don Zeek on 1/8/19.
6 // Copyright © 2019 net.dzeek.y2015.ios.portfolio. All rights reserved.
7 //
8 
10 
11 @implementation UILabel (Y5GradientFace)
12 - (void) postAttributedText:(NSString *)txt
13 {
14  [self setNumberOfLines:0];
15  if (nil == txt) {
16  [self setText:@"err"];
17  } else if ([self respondsToSelector:@selector(setAttributedText:)]) {
18  UIFont *herefont = [UIFont fontWithName:@"DamascusBold" size:12];
19  // [attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, [attributedString length])];
20  NSDictionary *attribs = @{
21  NSForegroundColorAttributeName: self.textColor,
22  NSFontAttributeName: herefont
23  };
24  NSMutableAttributedString *attributedText =
25  [[NSMutableAttributedString alloc] initWithString:txt
26  attributes:attribs];
27  [self setAttributedText:attributedText];
28  } else {
29  [self setText:txt];
30  }
31  [self setTextAlignment:NSTextAlignmentCenter];
32 }
33 
34 @end