[IOS Weibo project, [iOS blog Project
Github: https://github.com/hellovoidworld/HVWWeibo
A. Light gray background of Weibo1. Requirements
- The background color needs to be set for the Weibo part.
- Use an image as the background
2. IdeasMethods:
- Directly set the background image of the view and use the tiled image of UIColor.
- Achieve the drawRect method of view, stretch the background image (draw the background image to the entire view)
- Forward the Weibo view to inherit the ImageView and set the image directly. In this way, you can set the highlighted image.
3. Implementation(1) directly set backgroundColor and tile images
1 // set the Background 2 // set the background image in Tiled Mode 3 self. backgroundColor = [UIColor colorWithPatternImage: [UIImage imageWithNamed: @ "timeline_retweet_background"];
However, because the image is tiled, the upper and lower edges of the image form many "thin lines" 1-(void) drawRect :( CGRect) rect {2 [[UIImage imageWithNamed: @ "timeline_retweet_background"] drawInRect: self. bounds]; 3} 1 // set the background image 2 [self setImage: [UIImage imageWithNamed: @ "timeline_retweet_background"]; 3 [self setHighlightedImage: [UIImage imageWithNamed: @ "timeline_retweet_background_highlighted"];