Retina tiled background for Launch Screen.nib

心已入冬 提交于 2020-01-11 04:33:08

问题


I'm trying out the new funky Launch Screen.xib (storyboard) instead of using launcher images in my iOS app.

On my first page I have a tiled background image called bodybg@2x.png which I put on the background of that first page via code:

self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"bodybg.png"]];

So I could do with having the same background on the Launch Screen. Presumably there's no way to execute code when the Launch Screen.xib is loaded, so how do I go about putting a tiled, retina background on a Launch Screen.xib?


回答1:


  1. Add the image to an asset catalog.
  2. Choose Editor > Show Slicing.
  3. Change slicing configurations as the following (100x100 image is used here): (This tells Xcode that there are no fixed parts and the entire image should be tiled).
  4. Add UIImageView to your launch screen and use the previous image. Set the mode to Scale to Fill and the image will be tiled to fill the image view.


来源:https://stackoverflow.com/questions/26613831/retina-tiled-background-for-launch-screen-nib

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!