我有三个 UIViewController 和一个带有 UISegmentControl 的单独视图控制器,我必须使用导航控制器推送 3 个视图控制器。I want all these views to appear below UISegmentControl when any segmentcontrol is selected. 我尝试了推送和弹出逻辑,但无法得到正确的结果。以下是一个控制器的代码 -
-(IBAction)valueChanged:(id)sender{
segmentControl=(UISegmentedControl*)sender;
if (segmentControl.selectedSegmentIndex==1) {
firstView = [self.storyboard instantiateViewControllerWithIdentifier:@"FirstTopViewController"];
[self.navigationController pushViewController:firstView animated:YES];
[self.navigationController popViewControllerAnimated:NO];
self.navigationController.navigationItem.titleView=segmentControl;
NSLog(@"1");
}
}
谁能告诉我我在这里做错了什么?