Showing posts with label wkinterfacelabel. Show all posts
Showing posts with label wkinterfacelabel. Show all posts

Tuesday, March 24, 2015

Change font and size in watchkit

Change font and size in watchkit



  1. Create IBOutlet of your WKInterfaceLabel
  2. Create UIFont object

    UIFont
    * labelFont = [UIFont fontWithName:@"Courier-Bold" size:8];
  3. Create NSAttributedString object

    NSAttributedString *labelText = [[NSAttributedString alloc] initWithString : @"my Label string title" attributes : @{ NSKernAttributeName : @2.0, NSFontAttributeName : labelFont}];
  4. set attributedString to label

    [self.label setAttributedText:labelText];