Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对不同版本的 iOS SDK 和网上的信息有点困惑。所以我不确定在 iOS 6 SDK 的情况下我应该如何绘制一个填充的矩形。谁能指导我找到答案?
有多种方式。您可以尝试以下方法:
-(void)drawRect:(CGRect)rect { CGContextRef cont = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(cont, 1.0, 1.0, 0.0, 1.0); CGContextFillRect(cont, CGRectMake(50.0, 50.0, 50.0, 50.0)); }