IOS UIview设置背景图片以及设置背景色遇到的问题
UIview设置背景图片self.view.backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"title.png"]];set uitableviewcell image background:UIImageView *bgView = [[UIImageViewal
·
UIview设置背景图片
self.view.backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"title.png"]];
set uitableviewcell image background:
UIImageView *bgView = [[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"title_dept_date.png"]];
bgView.alpha = 0.6;
cell.backgroundView = bgView;
UIview在使用PNG 透明图片时遇到,背景为黑色的问题解决:
1. 透明模式,设置backgroundColor属性之后,你需要设置opaque
属性为NO
在两个视图及其层。下面是一个示例:
UIView* paperView = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,700)];
paperView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"paper.png"]];
[paperView.layer setOpaque:NO];
paperView.opaque = NO;
2. 我还没有真正做到了这一点,但这里是我想尝试。 设置UIView的
.backgroundColor
至
[UIColor clearColor]
。然后把包含你的PNG一个UIImageView的“最低”项目的子视图的UIView的堆栈。确保的UIImageView的背景颜色也很清楚。
3. 使用此:myView.backgroundColor=[的UIColor clearColor]; 这将其设置为透明背景。
更多推荐
已为社区贡献1条内容
所有评论(0)