如何将一个现成的项目(使用应用程序委托创建并启动,但没有xib,nib)添加到另一个项目 [英] how to add a ready-to-use project ( created and started with application delegate but without xib,nib) to another project

查看:60
本文介绍了如何将一个现成的项目(使用应用程序委托创建并启动,但没有xib,nib)添加到另一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现成的项目(使用应用程序委托创建并开始,但没有xib,nib).现在,我想从另一个项目中调用并启动它. 但是我不能使用initwithnib,如何从另一个项目中包含并启动该现成的项目? 更具体地说,如何添加和集成Apple的示例代码"TableViewUpdates(TVAnimationsGestures.xcodeproject)",该示例代码只有自己的appDelegate和Mainwindow.xib文件到我自己的应用程序中?谢谢! 或者,您可以将xib文件添加到Apple的示例代码"TableViewUpdates(TVAnimationsGestures.xcodeproject)"中,以便在另一个项目中使用initWithNib来调用和运行示例代码.谢谢!

I have a ready-to-use project ( created and started with application delegate but without xib,nib). Now I want to invoke and start it from another project. But I can't use initwithnib, how can I include and start this ready-to-use project from another project? More specifically, how to add and integrate Apple's Sample code " TableViewUpdates ( TVAnimationsGestures.xcodeproject ) " which only has its own appDelegate and Mainwindow.xib file to my own application? thanks! Or can you add a xib file to the Apple's Sample code " TableViewUpdates ( TVAnimationsGestures.xcodeproject ) " so that I may use initWithNib in my another project to invoke and run the sample code. thanks !

推荐答案

我在Xcode 4.3.2上工作.

I work on Xcode 4.3.2.

  1. 创建sigle视图sigle视图应用程序.
  2. 在MoviePlayer示例中展开所有文件夹.选择所有文件,但info.plist,main,Frameworks,Products文件夹,readme.txt,MoviePlayer.project除外.将它们复制到新的空项目.不要忘记选中添加到目标".
  3. 在目标的构建阶段"选项卡中添加了MediaPlayer.framework(在具有Bins和libs的链接中)
  4. 将MainWindow.xib中的所有对象复制到viewController的xib中.
  1. Create sigle view sigle view app.
  2. Expand all folders in MoviePlayer example. Select all files, except info.plist, main, Frameworks, Products folders, readme.txt, MoviePlayer.project. Copy them to new empty project. Don't forget to check "add to target".
  3. In target's build phase tab added MediaPlayer.framework (in link Binary with libs)
  4. Copy all object from MainWindow.xib to your own xib for your viewController.

在ViewController.h中比:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITabBarController *tabBarConroller;

@end

将您的tabBarController从ViewController.xib连接到属性.

Connect your tabBarController from ViewController.xib to the property.

在ViewController.m中比:

@implementation ViewController
@synthesize tabBarConroller;

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view addSubview:tabBarConroller.view];
}

- (void)viewDidUnload
{
    [self setTabBarConroller:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}
...other appdelegateMethods ...
@end

7.检查viewController.xib中的所有对象是否都具有必要的出口.
6.编辑>重构>转换为ARC. (接下来,好的...)

7. Check that all objects in viewController.xib has necessary outlets.
6. Edit > Refactor > Convert to ARC. (next, ok...)

完成了.

这篇关于如何将一个现成的项目(使用应用程序委托创建并启动,但没有xib,nib)添加到另一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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