Combining Two Xcode Projects: One with code and one without

柔情痞子 提交于 2019-12-11 20:12:54

问题


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

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.


回答1:


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];
}


来源:https://stackoverflow.com/questions/24844477/combining-two-xcode-projects-one-with-code-and-one-without

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!