开发者

set alpha background image iphone application in xcode

I got this:

self.vie开发者_如何学Pythonw.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png" ]];

and some other stuff like textfields and stuff on one view.

I want to set the backgroundimages alpha so that it doesnt distract. but when i do:

self.view.alpha

it sets it for all objects :-(

and there is no:

self.view.backgroundcolor.alpha

any idea?


I worked it out so that you don't need 2 separate views.

    // Make sure your whole view is NOT transparent
    self.view.alpha = 1.0f;
    // Use UIColor to set alpha transparency of just the background view
    self.view.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f];

Voila!


That's how it works. To achieve the effect you desire, you need two separate views, one that contains just the background (and has its alpha set), and one with a transparent background and alpha of 1.0 that contains the other controls.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜