1 // 设置背景 2 // 使用平铺方式设置背景图片 3 self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithNamed:@"timeline_retweet_background"]];但是由于是平铺图片,图片的上下边缘部分会形成很多"细线" (2)实现drawRect
1 - (void)drawRect:(CGRect)rect { 2 [[UIImage imageWithNamed:@"timeline_retweet_background"] drawInRect:self.bounds]; 3 }(3)改变view的父类为ImageView,直接设置image属性
1 // 设置背景图片 2 [self setImage:[UIImage imageWithNamed:@"timeline_retweet_background"]]; 3 [self setHighlightedImage:[UIImage imageWithNamed:@"timeline_retweet_background_highlighted"]];
转载于:.html
本文发布于:2024-02-04 14:40:00,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170709549056450.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |