如何使用 xib 开发多屏应用?
How to develop an app with multiple screens using xib?
我知道这个很笨question.But我是新手iosdevelop.And连基础知识都不知道
在Xcode7.1,新建项目时,storyBoard是default.I想用xib开发一个多屏appfiles.Please请问如何实现?
- 如何设置启动画面?
- 如何连接不同的xib文件?
不管怎样,你能告诉我如何通过step.Thank你的步骤使用xib构建一个简单的项目吗?
如果你想拥有多个XIB,请按照以下步骤操作
First remove the storyboard file from your project
In Deployment Info of TARGETS,delete Main from Main Interface
The create the View(XIB). Give the name as ViewController.Xib
然后在appDelegate.h
import - #import "ViewController.h"
@property (strong, nonatomic) ViewController *vc;
然后在appDelegate.m
@synthesize vc;
然后在 didFininshLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
vc = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
UINavigationController *navigationVC = [[UINavigationController alloc]initWithRootViewController:vc];
self.window.rootViewController = navigationVC;
self.window.backgroundColor = [UIColor clearColor];
[self.window makeKeyAndVisible];
return YES;
}
接下来如果要创建多个xib,可以根据自己的需要用.h,.m,xib创建。
我知道这个很笨question.But我是新手iosdevelop.And连基础知识都不知道
在Xcode7.1,新建项目时,storyBoard是default.I想用xib开发一个多屏appfiles.Please请问如何实现?
- 如何设置启动画面?
- 如何连接不同的xib文件?
不管怎样,你能告诉我如何通过step.Thank你的步骤使用xib构建一个简单的项目吗?
如果你想拥有多个XIB,请按照以下步骤操作
First remove the storyboard file from your project
In Deployment Info of TARGETS,delete Main from Main Interface
The create the View(XIB). Give the name as ViewController.Xib
然后在appDelegate.h
import - #import "ViewController.h"
@property (strong, nonatomic) ViewController *vc;
然后在appDelegate.m
@synthesize vc;
然后在 didFininshLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
vc = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
UINavigationController *navigationVC = [[UINavigationController alloc]initWithRootViewController:vc];
self.window.rootViewController = navigationVC;
self.window.backgroundColor = [UIColor clearColor];
[self.window makeKeyAndVisible];
return YES;
}
接下来如果要创建多个xib,可以根据自己的需要用.h,.m,xib创建。