开发者

Initialize a UIImageView object with a rectangle image which will be created by programming

I want to create a UIImageView object and initialize it with a rectangle image that will be created by programming and NOT from a pre-created bitmap file.

Than开发者_如何学Pythonks in advance,

Sagiftw


To create a rectangle filled with blue:

CGRect imageRect = CGRectMake(0, 0, <#CGFloat width#>, <#CGFloat height#>);
UIGraphicsBeginImageContext(imageRect.size);
[[UIColor blueColor] set];
UIRectFill(imageRect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// now do something with image
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜