How to set a background image in Xcode using swift?

后端 未结 8 955
感动是毒
感动是毒 2020-12-23 13:08

How can I set a background image for my main view controller in Xcode 6 using swift? I know that you can do this in the assistant editor as below:

overri         


        
8条回答
  •  Happy的楠姐
    2020-12-23 13:50

    Swift 5.3 in XCode 12.2 Playgrounds

    Place the cursor wherever in the code the #insertLiteral would have been in earlier versions. Select from the top-menu Editor->Insert Image Literal... and navigate to the file. Click Open.

    The file is added to a playground Resource folder and will then appear when the playground is run in whichever view it was positioned when selected.

    If a file is already in the playground Bundle, e.g. in /Resources, it can be dragged directly to the required position in the code (where it will be represented by an icon).

    cf. Apple help docs give details of this and how to place other colour and file literals.

提交回复
热议问题