【发布时间】:2012-12-01 05:09:21
【问题描述】:
我正在开发一个 Iphone 应用程序。
我正在创建一个 UIView:
UIView *popupView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 250)];
然后我想用一张图片作为视图的背景:
UIColor * bgColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"blue_bg.png"]];
popupView.backgroundColor = bgColor;
有没有办法让背景半透明?可能将 alfa 值设置为 0.5 或给它一个不透明度。
我尝试使用 Photoshop 使图像透明,但是当我将其设置为背景时,它不再透明。
请注意,我只需要背景是透明的,而不是子视图
非常感谢您的帮助
【问题讨论】:
-
如何设置alpha?谢谢
-
我以为你确实知道如何设置它 :-) Indler 的回答来得很快。
标签: iphone objective-c background transparency