ios给view设置背景颜色的正确方式
2016-09-14 09:36
211 查看
UIView *back=[[UIView
alloc]initWithFrame:CGRectMake(0,
0, WIDTH,
HEIGHT)];
UIImage *image=[UIImage
imageNamed:@"background.jpg"];
back.layer.contents=(__bridge
id _Nullable)(image.CGImage);
back.layer.backgroundColor=[UIColor
clearColor].CGColor;
住:直接调用background方法,图片不会被拉伸,所以会导致图片显示异常
alloc]initWithFrame:CGRectMake(0,
0, WIDTH,
HEIGHT)];
UIImage *image=[UIImage
imageNamed:@"background.jpg"];
back.layer.contents=(__bridge
id _Nullable)(image.CGImage);
back.layer.backgroundColor=[UIColor
clearColor].CGColor;
住:直接调用background方法,图片不会被拉伸,所以会导致图片显示异常
相关文章推荐
- iOS中通过设置CSS改变WebView字体大小,颜色,背景颜色
- ios tableview和cell背景颜色设置
- IOS tableView 选中时的背景颜色设置
- IOS_设置UITableView Section的背景颜色和字体颜色(自定义section布局)
- iOS中通过设置CSS改变WebView字体大小,颜色,背景颜色
- iOS 7 UITableview 在Plain模式下 设置背景颜色无效
- ios 设置UITableView 选中行cell的背景颜色(自定义选中的背景颜色)
- iOS中通过设置CSS改变WebView字体大小,颜色,背景颜色
- IOS-UITableView设置背景图片,方式与众不同。
- iOS_自定义view里的按钮点击不了+背景颜色也设置不了
- 【iOS开发-31】UITabBar背景、icon图标颜色、被选中背景设置以及隐藏UITabBar的两种方式
- iOS开发UITabBar背景、icon图标颜色、被选中背景设置以及隐藏UITabBar的两种方式
- iOS中通过设置CSS改变WebView字体大小,颜色,背景颜色
- 【iOS开发-31】UITabBar背景、icon图标颜色、被选中背景设置以及隐藏UITabBar的两种方式
- view 设置背景颜色的集中方式
- UITableView Grouped风格时,设置背景颜色的问题
- IOS开发之TableView以及TableViewCell背景设置
- IOS-UITableView手动添加时,Header Section的背景设置
- 话说内部类与匿名内部类、正则表达式检验计算器输入(00)处理方式、设置JRame背景颜色实例
- 设置UITableView Section的背景颜色和字体颜色-自定义Section