Reputation: 6323
I can write to iOS using something similar(UI instead of NS). But fails for OSX?
NSString *sText = @"Hello";
[sText drawInRect:CGRectMake(x, y, 150, 20) withFont:[NSFont boldSystemFontOfSize:fSize]];
// No visible @interface for 'NSString' declares the selector 'drawInRect:withFont:'
Upvotes: 0
Views: 194
Reputation: 6323
Another approach: using "drawAtPoint":
http://forums.macrumors.com/threads/drawing-text-to-an-nsview.904433/
Upvotes: 1
Reputation: 47169
You need to use NSAttributedString
properties on OS X:
NSString *sText = @"Hello";
[sText drawInRect:CGRectMake(x, y, 150, 20) withAttributes: @{ NSFontAttributeName :
[NSFont boldSystemFontOfSize:fSize] }];
Upvotes: 2