Hello.
Strange situation - examples from apple works, but after i change them a bit, text is not displayed. This bit of code correctly draws blue background but refuses to draw text on it no matter what i do:
#import <UIKit/UIKit.h>
@interface CWnd : UIWindow @end
@implementation CWnd
- (void) drawRect : (CGRect) i_poRect
{
// This is working : windows is blue.
CGContextRef oContex = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor( oContex, 0, 0, 255, 1 );
CGContextFillRect( oContex, i_poRect );
// This is not working : not text is displayed.
CGContextSelectFont( oContex, "Monaco", 10, kCGEncodingFontSpecific );
CGContextSetRGBStrokeColor( oContex, 255, 0, 0, 1 );
CGContextSetRGBFillColor( oContex, 255, 0, 0, 1 );
CGContextSetTextDrawingMode( oContex, kCGTextFill );
CGContextSetTextPosition( oContex, 100, 100 );
CGContextShowText( oContex, "abc", 3 );
}
@end
@interface CDelegate : NSObject <UIApplicationDelegate> @end
@implementation CDelegate
- (void)applicationDidFinishLaunching : (UIApplication *) i_poApp
{
CGRect oRect = [ [ UIScreen mainScreen ] bounds ];
[ [ [ CWnd alloc] initWithFrame : oRect ] makeKeyAndVisible ];
}
@end
int main(int argc, char *argv[])
{
return UIApplicationMain( argc, argv, nil, @"CDelegate" );
}