iOS 实现安卓.9效果拉伸图片

实现效果

代码如下:

UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Publish_contentView"]];
 iv.frame = CGRectMake(10, 100, iv.image.size.width, iv.image.size.height);
UIImage *iamge = [UIImage imageNamed:@"Publish_contentView"]; iamge = [iamge stretchableImageWithLeftCapWidth:0 topCapHeight:10];
UIImageView *iv2 = [[UIImageView alloc] initWithFrame:CGRectMake(200, 100, iamge.size.width, iamge.size.height+100)];
iv2.image = iamge;
[_container addSubview:iv];
[_container addSubview:iv2];
posted @ 2020-05-19 21:47  Love margin  阅读(226)  评论(0编辑  收藏  举报