Basit bir mavi daire ile 20x20 UIImage yapmaya çalışıyorum. Bu işlevle deniyorum, ancak sonuç, siyah bir kare içinde mavi bir dairedir. Dairenin çevresindeki siyah kareyi nasıl kaldırırım?Basit bir daire çizme uiimage
Fonksiyon:
+ (UIImage *)blueCircle {
static UIImage *blueCircle = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
UIGraphicsBeginImageContextWithOptions(CGSizeMake(20.f, 20.f), YES, 0.0f);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);
CGRect rect = CGRectMake(0, 0, 20, 20);
CGContextSetFillColorWithColor(ctx, [UIColor cyanColor].CGColor);
CGContextFillEllipseInRect(ctx, rect);
CGContextRestoreGState(ctx);
blueCircle = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
});
return blueCircle;
}
gerçek sonuç:
Potansiyel Eğer bir imageView http://stackoverflow.com/questions/6589265/how-to- yerine bir görünüm kullanmanız gerekir deneyin bir-çizmek-bir-uiview-bu-sadece-bir-daire-iphone-app – Woodstock