這是我的主要看法,我只是希望它吸取一些東西來測試,但我發現我的UI沒有任何東西,這裏是代碼:爲什麼我不能在我的UIView上繪製一些東西?
- (void)viewDidLoad {
[super viewDidLoad];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextMoveToPoint(context, 100.0f, 100.0f);
CGContextAddLineToPoint(context, 200.0f, 200.0f);
CGContextStrokePath(context);
}
這是我複製的代碼示例線上。我假設代碼是正確的,它沒有任何錯誤,但沒有出現。或者......這段代碼不應該粘貼在viewDidLoad上?