我有一个 UIViewController 并且我希望它调用 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
但是当应用程序运行时,视图上没有绘制任何小马,我做错了什么?