我在推送视图控制器时遇到问题。这就是我所做的:单击按钮时,我使用此代码添加了一个模式视图,它工作正常:
- (void)addAction:(id)sender
{
uipickerForContract *addViewController = [[uipickerForContract alloc] initWithNibName:@"uipickerForContract" bundle:nil];
addViewController.delegate = self;
addViewController.modalPresentationStyle = UIModalPresentationFormSheet;
addViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:addViewController animated:YES];
addViewController.view.superview.frame = CGRectMake(50, 740, 695, 245);
}
这个添加的视图控制器包含一个完成按钮,我想使用它来导航到其他视图控制器:所以我使用了该代码但它不起作用,它只是关闭了 addeview:
donebutton{
nextview*s = [[nextview alloc]initWithNibName:@"nextview" bundle:nil];
s.view.frame = CGRectMake(10, 20, 745, 755);
//nextview contains the object that I want to pass :object
s.object= self;
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:self];
[self dismissModalViewControllerAnimated:YES];
[self.navigationController pushViewController:s animated:YES];
NSLog(@"self.nav%@",self.navigationController);
}