Reputation: 4820
Is there a way I can say for a particular UIImageView:
UIImageView *imageView = <#instantiate#>
imageView.image = @"someImageFromImageAsset";
and based on the device it's rendering on, it sets the right image. Obviously I need to set the image for a particular device but I am unsure how you do it.
Upvotes: 8
Views: 8947
Reputation: 4840
iOS will automatically choose the correct sized image if you just use the name of the image. Use @2x in the image file name for retina display.
Objective-C
imageView.image = [UIImage imageNamed: @"someImageName"];
Swift
imageView.image = UIImage(named: "someImageName");
Upvotes: 16