iOS uiview添加背景图案


1.

 UIImage *image = [UIImage imageNamed:@"me_Framebackgroud.png"];
        view.layer.contents = (id) image.CGImage;    // 如果需要背景透明加上下面这句
        view.layer.backgroundColor = [UIColor clearColor].CGColor;

2.
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
//    imageView.image = [[UIImage imageNamed:@"me_Framebackgroud.png"] stretchableImageWithLeftCapWidth:0 topCapHeight:0];
//    [view addSubview:imageView];

相关