开发者

How to push UIViewController

开发者 https://www.devze.com 2023-01-08 21:27 出处:网络
I have UIViewController in Viewbased application. I want to push another UIViewcontroller from it. -(IBAction) Myfunction

I have UIViewController in Viewbased application. I want to push another UIViewcontroller from it.

-(IBAction) Myfunction
{

 MedicineSearchSystem *medicineSearchSystem = [[MedicineSearchSystem alloc]        initWithNibName:@"MedicineSearchSystem" bundle:nil];

 [self.parentViewController:medicineSearchSystem animated:YES]; // Crash here

}
开发者_运维技巧


As warrenm already told you, first check if your viewController has a navigationController by calling something like : NSLog(@"%@", self.navigationController) then you can push using:

[self.navigationController pushViewController:medicineSearchSystem animated:YES];

    self.mainItemListViewController = [[[NCItemsViewController alloc] init] autorelease];

self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.mainItemListViewController];

[window addSubview:[self.navigationController view]];
[window makeKeyAndVisible];  
0

精彩评论

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

关注公众号