开发者

Add separate UINavigationController to child class

开发者 https://www.devze.com 2023-03-17 22:07 出处:网络
How to add my own UInavigationController to child class. Here is my code VC1 *vController= [[VC1 alloc]init];

How to add my own UInavigationController to child class.

Here is my code

    VC1 *vController  = [[VC1 alloc]init];

[self.navigationController pushViewCon开发者_如何学Pythontroller:vController animated:YES];

[vController release];

I need to add one more navigationcontroller to vController . so I can maintain separate stack for child.

I tried this way but it did not work for me.

UINavigationController *navController=[[UINavigationController alloc] initWithRootViewController:self];
  [self.view addsubview:navController.view];

[navController release];

it is overlapping on parent navigationController.


Lets say you have "A" Main Navigation controller & B controller whether inherited by TableView or anything.

Create object of UINavigationController in B . Create object of B in A like B *bObject. Pass self.navigationControl to B like

bObject.navgationObject=self.navigationController

and access all navigation with navgationObject in B. Not need to call self.navigation in B just use navgationObject.

I hope this is ur answer


Try the following:

VC1 *vController  = [[VC1 alloc]init];
UINavigationController *navController= [[UINavigationController alloc]   initWithRootViewController:vController];
[self.navigationController presentModalViewController:navController animated:YES];

[vController release];

It's modal, so to remove it you're going to need a reference to the parent navigationController to dismiss the child navigation controller.

0

精彩评论

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

关注公众号