iOS 8 Extension: how to use xib inside Cocoa Touch

2019-09-01 14:36发布

问题:

I'm creating an iOS 8 extension(Action extension in specific), I have some user interfaces that are both used in extension and my container app, so that I want to put those view controllers with their xibs inside my Cocoa Touch Library, so that I can share them between my app and extension.

But to my surprise, those xibs are neither in container app's bundle nor are they in my extension's bundle, so that neither of my app or extension can read those xibs.

What should I do to achieve this?

回答1:

You need to set the target to both your main app and the extension app. Click on the xib file and then on the right you will have the option which targets to include that xib in