1烦绳、 self.view.backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"image.jpg"]];(占內(nèi)存滓玖,且不能拉伸)
2、 NSString *path = [[NSBundlemainBundle]pathForResource:@"image"ofType:@"jpg"];
self.view.backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageWithContentsOfFile:path]];(同樣占內(nèi)存,且不能拉伸)
3热芹、添加uiimageview (代碼量太多,麻煩)
4、推薦使用
NSString *path = [[NSBundlemainBundle]pathForResource:@"image"ofType:@"jpg"];
UIImage *image = [UIImageimageWithContentsOfFile:path];
self.view.layer.contents = (id)image.CGImage;