简体   繁体   中英

Xcode, How to Preview Images in shared storyboard sourced from different targets

I have an Xcode 8.2 project with two targets 1) Monkey 2) Donkey

1) Monkey has an asset catalog called MonkeyAssets.xcassets 2) Donkey has an asset catalog called DonkeyAssets.xcassets

The each have an image called LaunchImage

Both Targets share the Storyboard LaunchScreen.storyboard here we display the LaunchImage in an imageview.

How can I switch between monkey/donkey in interface builder? Without running the app.

Interface builder seems to choose one of the asset catalogs and stick with it. I have tried toggling the Target Memberships but this is ignored

Possibly a duplicate but cannot find this.

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Had similar problem. It looks like IB tries to find the closest .xcassets folder in the folder's tree. If it finds several in the same folder - it takes the first in alphabetical order or smth like that (due to post )

My solution: just separate yours .xcassets folders to separate folders (like Donkey and Monkey) and add 2 Launch.storyboard s into these folders and mark Target Membership for each correspondingly (one Launch.storyboard for Monkey target and one Launch.storyboard for Donkey target)

So in the end you must have something similar to:

files and folders structure

Works on my XCode 11.0 (11A420a)

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM