Search code examples
iosresizable

how to make resizable image with @2x file?


My code:

self.commentTextViewBorder.image = [[UIImage imageNamed:@"border_comment_field"]
resizableImageWithCapInsets:UIEdgeInsetsMake(11, 11, 11, 11)];

I found it did not user @2x image file to make resiable. Is it any problem?


Solution

  • Put your image_name.png & image_name@2x.png at your main bundle folder, and just use

    [UIImage imageNamed:@"image_name.png"];
    

    is fine. The correct one will be used automatically depend on the devices w/ or w/o retina display.