相关疑难解决方法(0)

在UIViewController中添加UINavigationController

我有一个带UIToolbar的UIViewController(在底部),我想在里面添加一个带UINavigationBar的UINavigationController.但是不显示UINavigationController.

MyViewController.m:

- (void)viewDidLoad
{
    [super viewDidLoad];

    int toolBarHeight = 44;
    UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, [self.view bounds].size.height-toolBarHeight, [self.view bounds].size.width, toolBarHeight)];

    UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:nil action:nil];
    toolBar.items = @[button];

    [self.view addSubview:toolBar];

    MyNavigationController *myNav = [[MyNavigationController alloc] init];

    [self addChildViewController:myNav];
}
Run Code Online (Sandbox Code Playgroud)

iphone uiviewcontroller uinavigationcontroller ios

8
推荐指数
1
解决办法
1万
查看次数