首先新建一个RootViewController 再建一个FirstViewController
在RootViewController.m中写入
#import "WJJRootViewController.h"
#import "WJJFirstViewController.h"
@interface WJJRootViewController ()
@end
@implementation WJJRootViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor grayColor];
[self createMyNavigationBar];
}
- (void)createMyNavigationBar{
//手机最上面的状态栏20像素 系统导航栏高度为44 所以一共64像素
UIView * navigationBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
navigationBar.backgroundColor = [UIColor redColor];
[self.view addSubview:navigationBar