我想在viewContoller的视图中绘制填充矩形.我在viewDidLoad中写了下面的代码.但没有变化.怎么了?
CGRect rectangle = CGRectMake(0, 100, 320, 100);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0);
CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0);
CGContextFillRect(context, rectangle);
Run Code Online (Sandbox Code Playgroud)