我有一個UIViewController,我希望它調用drawRect,所以我可以在視圖上繪製,但沒有任何反應。ViewController和drawRect
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
...code...
}
@end
和實現
#import "ViewController.h"
@implementation ViewController
-(void) drawRect:(CGRect) rect {
draw a pony
}
- (void)viewDidLoad {
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
但沒有得到小馬上畫時,應用程序運行的觀點,我該怎麼辦錯了嗎?