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];

 

posted on 2021-12-28 13:59  高彰  阅读(84)  评论(0编辑  收藏  举报

导航