Adding three subviews each with Navigationcontroller Stupid?
Hello i created three books(UIViews) each with it's own Navigationcontroller for paging. My questions
!) Does it make any sense to use three Navigationcontroller 2) Is my code below any good? It seems to work but the bar has a ofset of 20px from the top.
#开发者_如何转开发import "Book_01.h"
@implementation Book_01 // UIViewController
@synthesize book_01_NavigationController;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
[self.view addSubview:book_01_NavigationController.view];
}
return self;
}
Man, your code it's okei. But, you need to declare your navigation controller first:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
book_01_NavigationController = [[UINavigationController alloc] initWithRootViewController:self];
[self.view addSubview:book_01_NavigationController.view];
}
return self;
}
About ofset of 20px from the top. That's because your status bar it's hidden. You need to adjust the elements to fullscreen.
[]'S
精彩评论