2016-04-29 19 views
1

我在翻譯的Objective-C做出了新雨燕2.0的語言的舊的應用程序,但我有在代碼這一行有些很難故事板實例化:SWIFT - 從Objective-C的

UIStoryboard *sdkStoryboard = [UIStoryboard storyboardWithName:@"MyStoryboard" bundle:[NSBundle bundleWithIdentifier:@"thirdParty.MySDK"]]; 

問題在於「捆綁」部分,我做了很多研究,但沒有一個能夠做到這一點,因爲大多數例子發現「捆綁:無」

這是我現在可以做的:

let sdkStoryboard: UIStoryboard = UIStoryboard(name: "MyStoryboard", bundle: ???) 

謝謝!

回答

0

如何:

UIStoryboard(name: "MyStoryboard", bundle: NSBundle(identifier: "thirdParty.MySDK")) 
+0

謝謝!這就是訣竅!我正在使用「路徑:」而不是「標識符:」 –

-1

試試這個:

let Bundlepath = NSBundle(identifier: "thirdParty.MySDK") 
let sdkStoryboard: UIStoryboard = UIStoryboard(name: "MyStoryboard", bundle: Bundlepath) 

商祺!

+0

謝謝!這就是訣竅!我正在使用「路徑:」而不是「標識符:」 –

0
let storyboard = UIStoryboard(name: "MyStoryboard", bundle: nil) 
let vc = storyboard.instantiateViewControllerWithIdentifier("thirdParty.MySDK") as! UIViewController 
self.presentViewController(vc, animated: true, completion: nil)