开发者

UIView rounded corners don't work with color pattern?

I have this, it works fine:

 self.rightbarshadow.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]];

However, this no longer works:

 self.rightbarshadow.layer.cornerRadius=30;

If instead, I change the background color to this:

self.rightbarshadow.backgroundColor=[UIColor grayColor];

Then the cornerRadius works.

So I assume you can't round corners if you have a background color ima开发者_如何学Goge pattern?


Did you try to apply the backgroundColor on the layer instead of on the view?

self.rightbarshadow.layer.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]].CGColor;

Not on my Mac right now to test it in live, and I'm not sure if CGColor is compatible with pattern UIColors or if it only manages uniform colors, but you should give it a try.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜