开发者

Adding three subviews each with Navigationcontroller Stupid?

开发者 https://www.devze.com 2023-04-05 11:18 出处:网络
Hello i created three books(UIViews) each with it\'s own Navigationcontroller for paging. My questions

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号