简体   繁体   English

在iOS App及其扩展程序之间共享情节提要

[英]Share Storyboard between iOS App and its Extension

I created a iOS App and a corresponding action extension. 我创建了一个iOS App和一个相应的动作扩展。 I managed to create a app group to share the NSUserDefaults between the app and the extension. 我设法创建了一个应用程序组,以在应用程序和扩展之间共享NSUserDefaults。

Now i want to reuse some parts of my storyboard from the main app in the extension. 现在,我想从扩展中的主应用程序重用故事板的某些部分。 How can I share the storyboard between the app and the extension? 如何在应用程序和扩展程序之间共享情节提要? Can anyone provide an example in Swift? 谁能在Swift中提供示例?

Thank you. 谢谢。

If you want to share views between your app and extension, you would need to create xibs for each view you wanted to share. 如果要在应用程序和扩展之间共享视图,则需要为要共享的每个视图创建xib。 These xibs would then be compiled in to a framework that is used by both your app and extension. 然后,将这些xib编译到应用程序和扩展程序都使用的框架中。

It also may be possible to create a separate storyboard with the shared views, then put this storyboard in to the framework. 也可以使用共享视图创建一个单独的情节提要,然后将该情节提要放到框架中。

The xib route seemed more correct to me, as you won't be composing a scene with the storyboard, just throwing a bunch of views in it. xib路线对我来说似乎更正确,因为您不会使用情节提要来构成场景,而只是在其中添加一堆视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用钥匙串在 iOS 扩展程序及其包含的应用程序之间共享? - Share between an iOS extension and its containing app with the keychain? 在iOS App和WatchKit Extension之间共享Plist - Share Plist between iOS App and WatchKit Extension 如何在主iOS应用与其共享扩展之间使用相同的经过身份验证的用户令牌 - How to use same Authenticated user token between main iOS app and its Share Extension iOS使用Alamofire快速在应用程序和共享扩展之间共享Cookie - iOS swift using alamofire to share cookie between app and share extension 用于在共享扩展和iOS应用之间共享文件路径/文件的代码 - Code to share file path/file between a share extension and iOS app 编写没有故事板的iOS 8共享扩展 - Writing an iOS 8 share extension without a storyboard 在iOS8中的App和App Extension之间共享用户对象 - Share User Object between App and App Extension in iOS8 主应用程序和共享扩展名之间的iOS共享.h文件 - iOS Sharing .h file between main app and share extension (iOS Swift)在应用程序和Today Extension之间共享EKEventStore和访问 - (iOS Swift) Share EKEventStore and access between app and Today Extension 在 iOS 8 共享扩展和主应用程序之间共享数据 - Sharing data between an iOS 8 share extension and main app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM