平常背景圖片鋪設一般都是
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
imageView.image = [UIImage imageNamed:@"你的背景圖片"];
[self.view addSubview:imageView];
然后把其他空間鋪在ImageView上,這種屬于初學者用的比較多的方法.
抑或是
self.view.backgroundColor = [UIColor colorWithPatternImage:@"你的背景圖片"];
這種方法的背景圖片大小是按照圖片的大小給的. 所以圖片的大小過大或者過小就容易出現問題.
但是這種方法就很好的解決了上述方法的問題,是我用的比較多的方法
self.view.layer.contents = (id)[UIImage imageNamed:@"你的背景圖片"].CGImage;