Unable to pushViewController for subview

后端 未结 6 1833
北荒
北荒 2021-01-03 08:12

I have a UINavigationController and I have seperate UIViews that I switch between using a UISegmentControl. On switching the views, I add the view as a subview to my navigat

6条回答
  •  孤街浪徒
    2021-01-03 08:56

    Instead of

    [self.view addSubview:segmentTab1.view];
    

    and

    [self.view addSubview:segmentTab2.view];
    

    you may use

    [self pushViewController: segmentTab1 animated: NO];
    

    and

    [self pushViewController: segmentTab2 animated: NO];
    

    to add your viewControllers to the navigation hierarchy, and make [super.navigationController pushViewController:detailsViewController animated:YES]; work.

提交回复
热议问题