需要UISegmentControl和UINavigationController推送ViewControllers

时间:2013-07-17 21:11:11

标签: ios uiviewcontroller pushviewcontroller popviewcontroller uisegmentedcontrol

我有三个UIViewControllers和一个带UISegmentControl的独立viewcontroller,我必须使用navigationControllers推送3个viewcontrollers。我希望在选择任何segmentcontrol时,所有这些视图都显示在UISegmentControl下面。我尝试了推送和弹出逻辑,但无法得到正确的结果。以下是一个控制器的代码 -

-(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");
    }
}

谁能告诉我这里我做错了什么?

0 个答案:

没有答案