如何在Xcode 5中使用xib文件而不是storyboard? [英] How can i use xib files instead of storyboard in Xcode 5?
问题描述
我对ios开发非常新,我观看的许多教程都遵循xib方法,因为它们是在XCode 5之前录制的。我如何在单视图应用程序中使用xib方法?当我删除故事板并选择其中一个xib作为主界面时,它无法正常工作。谢谢你的提示。
I'm very new to ios developing and many of the tutorials i watch follow the xib approach since they were recorded before XCode 5. How can i go with the xib approach in Single View Application? When i delete storyboard and select one of the xib's as the main interface it's not working. Thanks for any tip.
推荐答案
添加新文件,选择cococatouch并选择Objective -C类,然后转到下一个单击。 >
你显示下面的屏幕
底部的
必须选择用xib作为用户Interface.and next
add new file in that select the cococatouch and select the Objective -C class and then go to the next click.
you show the below screen
at the bottom must select the with xib for user Interface.and next
AppDelegate .h:
AppDelegate.h:
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
ViewController *viewObj;
UINavigationController *navObj;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewObj;
@property (strong, nonatomic) UINavigationController *navObj;
AppDelegate.m:
AppDelegate.m:
@synthesize viewObj,window,navObj;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
viewObj = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
navObj = [[UINavigationController alloc] initWithRootViewController:viewObj];
window.rootViewController=navObj;
[window makeKeyAndVisible];
return YES;
}
这篇关于如何在Xcode 5中使用xib文件而不是storyboard?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!