三种拉伸图片不变化到方法

方法都会返回一张新的图片需要来接受返回的新图片

    UIImage *image = [UIImage imageNamed:@"searchbar_textfield_background];


方法一
   searchBar.background = [image resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.5, image.size.width *0.5, image.size.height * 0.5, image.size.width * 0.5)];
  

 方法二
   searchBar.background = [image resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.5, image.size.width *0.5, image.size.height * 0.5, image.size.width * 0.5) resizingMode:UIImageResizingModeTile];
   
方法三

  searchBar.background = [image stretchableImageWithLeftCapWidth:image.size.width *0.5 topCapHeight:image.size.height *0.5]

        //取消iOS7自带的图片渲染功能
        resultImage = [resultImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

你可能感兴趣的:(三种拉伸图片不变化到方法)