开发者

UIColor `-colorWithPatternImage:` alpha blending problem solution. (iOS SDK 4.1)

Solution note, not a question.

I used this code to set background as a pattern image:

UIImage *bg     =   SomeImage();
UIColor *bgc    =   [UIColor colorWithPatternImage:bg];
[self setBackgr开发者_运维知识库oundColor:bgc];
[self setOpaque:NO];

This works, but alpha blending doesn't work. Might be a bug. How to make it work?

  • Platform: iOS SDK 4.1


This code make it alpha blended on both of simulator and device.

UIImage *bg     =   SomeImage();
UIColor *bgc    =   [UIColor colorWithPatternImage:bg];
[self setBackgroundColor:bgc];
[self setOpaque:NO];
[[self layer] setOpaque:NO];      // Added this line.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜