私は 3 つの UIViewControllers と UISegmentControl を持つ 1 つの個別のビューコントローラーを持っており、navigationControllers を使用して 3 つのビューコントローラーをプッシュする必要があります。セグメントコントロールが選択されたときに、これらすべてのビューが UISegmentControl の下に表示されるようにします。プッシュ ロジックとポップ ロジックを試しましたが、正しい結果が得られませんでした。以下は、1 つのコントローラーのコードです。
-(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");
}
}
ここで私が間違っていることを誰かに教えてもらえますか?