开发者

Presented modal navigationcontroller under current navigationcontroller iphone

开发者 https://www.devze.com 2023-01-19 10:26 出处:网络
In my application the mod开发者_开发问答al navigationcontroller that I am presenting is going under the current navigationcontroller so I\'m not able to view the new navigationbar as it\'s disappearin

In my application the mod开发者_开发问答al navigationcontroller that I am presenting is going under the current navigationcontroller so I'm not able to view the new navigationbar as it's disappearing under the current one.

I'm presenting the modalview on self and not self.navigationcontroller because self.navigationcontroller doesn't present the modalviewcontroller.

Also how to push a view on this modal navigationcontroller?

I'm using following code in one of my viewControllers:

fullListTopCompanies *fullListTopCompaniesInstance = [[fullListTopCompanies alloc] initWithNibName:@"fullListTopCompanies" bundle:nil];

UINavigationController *navigationController = [[UINavigationController alloc]

                                                initWithRootViewController:fullListTopCompaniesInstance];

fullListTopCompaniesInstance.navigationController.navigationItem.title = @"F";
[self presentModalViewController:navigationController animated:YES];


[navigationController release];

[fullListTopCompaniesInstance release];

Can anybody please help?

Thanx in advance.


use animated with transition

according to me you have to change the animation style

i done it before but forgot the code i will post it when i get it


self.navigationController.navigationItem.title = @"F";

Add the above line of code in viewDidLoad method of "fullListTopCompanies" class.


Actually your navigation bar hides because of the modal view and modal view by default doesnt have Navigation bar.To add a navigation bar to modal view you can try the below code:

In Header File

IBOutlet fullListTopCompanies *fullListTopCompaniesInstance;

In Implementation File

UINavigationController *nav = [[UINavigationController alloc] initWithNibName:@"fullListTopCompanies" bundle:nil];

[self presentModalViewController:nav animated:YES];

[nav release];

Also on the "fullListTopCompanies" View Controller dont forget to put a left navigation bar button item for dismissing the modal view.

So add that left bar button (Ideally Cancel Button on navigation bar) and event handler for that left barr button should contain the code

[self dismissModalViewControllerAnimated:YES];

Hope this helps.

0

精彩评论

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