문제

Is it possible to use the images added to Assets Catalog directly on interface builder? How is that done?

On UIImageView properties I can't see any option to reference any image on assets catalog.

도움이 되었습니까?

해결책

  1. Import the images into the .xcassets folder
    • click the '+' in the bottom right, 'Import folder'
  2. Setup each image with its 1x and 2x image size
  3. Give it a name

Images can then be referenced programmatically with UIImage *image = [UIImage imageNamed:@"some-image"], or via the image dropdown in IB/Storyboards.

다른 팁

All of the images in an asset catalog have a name. This name can be used in imageNamed: and in IB.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top