首页 > 其他 > 详细

使图片两边不拉伸,中间拉伸

时间:2016-05-25 15:00:51      阅读:250      评论:0      收藏:0      [点我收藏+]
- (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];
}

使图片两边不拉伸,中间拉伸

原文:http://www.cnblogs.com/MyBlogZH/p/5526664.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!