मैं इस यूआईसीओलर मूल्य से यूआईएममेज बनाने की कोशिश कर रहा हूं। UIImage बनाया जा रहा है, लेकिन अल्फा मान खो गया है। छवि अपारदर्शी बनी हुई है।यूआईसीओएल से UICmage अल्फा
@implementation GetImage
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size
{
UIImage *img = nil;
CGRect rect = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,
color.CGColor);
CGContextFillRect(context, rect);
img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
@end
कौन सा मैं बहुत की तरह फोन:
-(void) setButtonColours{
UIImage *img1, *img2;
UIColor *red = [UIColor colorWithRed:205.0/255.0 green:68.0/255.0 blue:51.0/255.0 alpha:1.0],
*blue = [UIColor colorWithRed:71.0/255.0 green:97.0/255.0 blue:151.0/255.0 alpha:1.0];
img1 = [GetImage imageWithColor: blue andSize: self.dummyButton.frame.size];
img2 = [GetImage imageWithColor: red andSize: self.dummyButton.frame.size];
[self.dummyButton setBackgroundImage: img1 forState:UIControlStateNormal];
[self.dummyButton setBackgroundImage: img2 forState:UIControlStateSelected];
}
किसी भी विचार है कि मैं क्या याद कर रहा हूँ मैं निम्नलिखित कोड का उपयोग कर रहा हूँ?
यह काम किया
इस लाइन की जगह! धन्यवाद! :) –