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];
原文地址:https://www.cnblogs.com/lovemargin/p/12919763.html