本文介绍了在XCode 4.2空应用程序模板中使用Interface Builder将tabbarcontroller添加到AppDelegate的步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 当我被卡住了问题我找不到向AppDelegate添加UITabBarController的正确步骤(不是以编程方式),但是通过使用空应用程序模板的界面构建器,我尝试添加一个新的空xib文件,然后将uitabbarcontroller放入其中,但没有办法将它(从IB)链接到AppDelegate!即当我将蓝线从tabbarcontroller对象(在文档大纲中)移动到文件的所有者时,界面构建器仅在显示的列表中显示委托选项,因此那里没有IBOutlet选项。while I'm stuck at this question I cannot find the right steps to add a UITabBarController to the AppDelegate (not programatically) but by using interface builder for the "Empty Application" template, I tried to add a new empty xib file, then dropped uitabbarcontroller into it, but there is no way to link it (from IB) to AppDelegate !! i.e. when I move the blue line from tabbarcontroller object (in document outline) to File's Owner, interface builder shows only the "Delegate" option in the shown list so there is no IBOutlet option in there.那么,使用界面生成器方式添加tabbarcontroller并将其连接到appDelegate的确切步骤是什么(对于空应用程序模板,使用XCode 4.2和IOS 5 SDK)?so, what are the exact steps for adding a tabbarcontroller and connect it to appDelegate using the interface builder way (for the Empty Application template, using XCode 4.2 and IOS 5 SDK) ?第1步:创建新的空应用程序模板项目。step1: create new Empty Application template project. ...等待后续步骤...... ... waiting for the next steps...非常感谢。推荐答案步骤1:创建新的空应用程序模板项目。 第2步:添加Step 1: create new Empty Application template project.Step 2: add @property (nonatomic, strong) IBOutlet UITabBarController *tabBarController;@property (nonatomic, strong) IBOutlet UIWindow *window;。 (别忘了合成这些)步骤3:在你的app delegate中更改这一行:in your app delegate. (dont forget to synthesize these)Step 3: change this line in your app delegate: @interface AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate>第4步:修改此方法- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[self.window addSubview:[self.tabBarController view]];[self.window makeKeyAndVisible];return YES;} 步骤5:创建一个新的空xib。将标签栏控制器拖到它上面以及一个空对象。 将空对象的类设置为AppDelegate。将文件所有者设置为UIApplication。 Step 5: create a new empty xib. Drag a tab bar controller on to it as well as an empty object.Set the empty object's class to AppDelegate. Set Files Owner to UIApplication. 步骤6:将委托属性从文件所有者拖到appdelegate类,然后将标签栏插件从appdelegate类拖到tabbarcontroller Step 6: drag the 'delegate' property from your files owner on to your appdelegate class and drag the tab bar outlet from you appdelegate class to your tabbarcontroller步骤7:添加一个窗口并将窗口连接从appdelegate拖到窗口。Step 7: Add a window and drag the 'window' connection from your appdelegate to the window.步骤8:不要忘记进入项目设置并将主基nib文件设置为您创建的新xib。Step 8: Dont forget to go into the project settings and set the main-base nib file to the new xib you created.就是这样。希望我没有错过任何东西。Thats it. Hope I didn't miss anything. 这篇关于在XCode 4.2空应用程序模板中使用Interface Builder将tabbarcontroller添加到AppDelegate的步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-26 17:06