UIImage *image = [UIImage imageNamed:@"bgimagename"];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 300, 100)];
//view.backgroundColor = [UIColor colorWithPatternImage:image]; //这种是正常的图片转成背景色
view.layer.contents = (id)image.CGImage;//这种的比较好,可支持半透明,兼容性又好。
[self.view addSubview:view];