- Create IBOutlet of your WKInterfaceLabel
- Create UIFont object
UIFont * labelFont = [UIFont fontWithName:@"Courier-Bold" size:8]; - Create NSAttributedString object
NSAttributedString *labelText = [[NSAttributedString alloc] initWithString : @"my Label string title" attributes : @{ NSKernAttributeName : @2.0, NSFontAttributeName : labelFont}]; - set attributedString to label
[self.label setAttributedText:labelText];
Showing posts with label watchkit. Show all posts
Showing posts with label watchkit. Show all posts
Tuesday, March 24, 2015
Change font and size in watchkit
Change font and size in watchkit
Monday, October 13, 2014
detecting iOS, iPhone, iPad and apple watch
detecting iOS, iPhone, iPad and apple watch
// detecting iOS
NSString *version = [[UIDevice currentDevice] systemVersion];
NSLog(@"Version:%@",version);
//detecting iPhone
add these line to your .h file
#define IS_IPHONE_4 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)480) < DBL_EPSILON)
#define IS_IPHONE_5 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)568) < DBL_EPSILON)
#define IS_IPHONE_6 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)667) < DBL_EPSILON)
#define IS_IPHONE_6_PLUS (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)736) < DBL_EPSILON)
and use it in your .m file
if (IS_IPHONE_4)
NSLog(@"iPhone 4");
else if (IS_IPHONE_5)
NSLog(@"iPhone 5");
//detecting iPad
if ([UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPad)
{
//code for iPad
}
//detecting apple watch
add these line to your .h file
#define IS_WATCH_42 (fabs((double)self.contentFrame.size.height - (double)174) < DBL_EPSILON)
#define IS_WATCH_38 (fabs((double)self.contentFrame.size.height - (double)151) < DBL_EPSILON)
and use it in your .m file
if (IS_WATCH_42)
NSLog(@"apple watch 42mm");
else if (IS_WATCH_38)
NSLog(@"apple watch 38mm");
Labels:
apple-watch,
check for iPad,
check for iPhone,
detecting apple watch,
detecting iOS,
detecting iPad,
detecting iPhone,
IdiomPad,
ios,
iOS version,
iPad,
iPhone,
screen Bound,
screen size,
UIDevice,
watchkit
// detecting iOS
NSString *version = [[UIDevice currentDevice] systemVersion];
NSLog(@"Version:%@",version);
//detecting iPhone
add these line to your .h file
#define IS_IPHONE_4 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)480) < DBL_EPSILON)
#define IS_IPHONE_5 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)568) < DBL_EPSILON)
#define IS_IPHONE_6 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)667) < DBL_EPSILON)
#define IS_IPHONE_6_PLUS (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)736) < DBL_EPSILON)
and use it in your .m file
if (IS_IPHONE_4)
NSLog(@"iPhone 4");
else if (IS_IPHONE_5)
NSLog(@"iPhone 5");
//detecting iPad
//detecting iPad
if ([UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPad)
{
//code for iPad
}
//detecting apple watch
add these line to your .h file
//detecting apple watch
add these line to your .h file
#define IS_WATCH_42 (fabs((double)self.contentFrame.size.height - (double)174) < DBL_EPSILON)
#define IS_WATCH_38 (fabs((double)self.contentFrame.size.height - (double)151) < DBL_EPSILON)
and use it in your .m file
if (IS_WATCH_42)
NSLog(@"apple watch 42mm");
else if (IS_WATCH_38)
NSLog(@"apple watch 38mm");
Labels:
apple-watch,
check for iPad,
check for iPhone,
detecting apple watch,
detecting iOS,
detecting iPad,
detecting iPhone,
IdiomPad,
ios,
iOS version,
iPad,
iPhone,
screen Bound,
screen size,
UIDevice,
watchkit
Subscribe to:
Posts (Atom)