结合两个 Xcode 项目:一个有代码,一个没有 [英] Combining Two Xcode Projects: One with code and one without

查看:34
本文介绍了结合两个 Xcode 项目:一个有代码,一个没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有两个 Xcode 项目:我的主项目使用故事板,另一个 Xcode 项目包含一个仅使用代码的视图控制器(没有故事板).第二个视图控制器(仅使用代码)遵循本教程:http://www.raywenderlich.com/55384/ios-7-best-practices-part-1

I currently have two Xcode projects: my main project that uses storyboard and another Xcode project that contains a single view controller that only uses code (no storyboard). The second view controller (that uses only code) follows this tutorial: http://www.raywenderlich.com/55384/ios-7-best-practices-part-1

我正在尝试将第二个(仅代码)项目添加到使用故事板的项目中.我想我可以添加所有 .m 和 .h 文件以及所有框架,然后当用户单击一个按钮时,它们将被带到那个视图控制器(在第二个项目中看到的控制器).问题是我不知道如何将按钮链接到控制器.如果我为按钮创建了一个 IBAction,是否可以添加任何代码来允许我访问视图控制器,或者它是否比这更复杂?

I am trying to add the second (code only) project to the project that uses storyboard. I figured I could add in all of the .m and .h files and all of the frameworks as well and then when the user clicks a button they will be brought to that one view controller (the controller seen in the second project). The problem is that I do not know how link the button to the controller. If I made an IBAction for the button, is there any code I can add that would allow me to access the view controller or is it much more complicated than that?

非常感谢任何建议或帮助.

Any suggestions or help is much appreciated.

推荐答案

因为你有一个只有代码的视图控制器和视图并且没有转场,你应该有这样的东西:

Since you have a code only view controller and view and with no segue, you should have something like:

//When the button is tapped
-(IBAction)buttonTapped:(id)sender
{
    //initialize the code only controller
    WXController *WXController = [[WXController alloc] init]

    //present the view
    [self presentViewController:WXController animated:YES completion:nil];
}

这篇关于结合两个 Xcode 项目:一个有代码,一个没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆