1

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;
}
Marcel
  • 11
  • 2

1 Answers1

1

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

Evandro Eisinger
  • 55
  • 1
  • 1
  • 5