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.
精彩评论