【代码笔记】iOS-使图片两边不拉伸,中间拉伸

代码:

【代码笔记】iOS-使图片两边不拉伸,中间拉伸
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view. //使图片两边不拉伸,中间拉伸
UIImage *image = [UIImage imageNamed:@"1.jpg"];
image = [image stretchableImageWithLeftCapWidth:floorf(image.size.width/2) topCapHeight:floorf(image.size.height/2)]; UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
imageView.backgroundColor=[UIColor redColor];
imageView.image=image;
[self.view addSubview:imageView];
}
【代码笔记】iOS-使图片两边不拉伸,中间拉伸
 
 
上一篇:label标签的可访问性


下一篇:ios加载html5 audio标签用js无法自动播放