why drawRect method is not being called?

Posted by user338322 on Stack Overflow See other posts from Stack Overflow or by user338322
Published on 2010-05-11T14:15:36Z Indexed on 2010/05/11 14:24 UTC
Read the original article Hit count: 264

Filed under:
|
#import <UIKit/UIKit.h>

@interface quartzViewController : UIViewController {
 IBOutlet UIView *myView;

}

@end


#import "quartzViewController.h"

@implementation quartzViewController


   -(void)drawRect:(CGRect)rect
   {   

 CGContextRef  context = UIGraphicsGetCurrentContext();
 CGContextSelectFont(context, "Arial", 24, kCGEncodingFontSpecific);
 CGContextSetTextPosition(context,80,80);
 CGContextShowText(context, "hello", 6);
 //not even this works
 CGContextShowTextAtPoint(context, 1,1, "hello", 6);
   }

   - (void)viewDidLoad {
 [myView setNeedsDisplay];

 [super viewDidLoad];
   }

Will I have to make any changed in the nib?

Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about drawrect