方法都会返回一张新的图片需要来接受返回的新图片
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];
网友评论