使用分段控制iphone导航

时间:2010-05-16 00:05:29

标签: iphone navigationcontroller

我在详细视图中的导航栏右侧创建了一个向上/向下箭头分段控制按钮。如何使用这些向上/向下箭头更改视图?

1 个答案:

答案 0 :(得分:1)

[mySegmentedControl addTarget:self action:@selector(mySegmentedControlTapped:) forControlEvents:UIControlEventValueChanged];
...

- (void) mySegmentedControlTapped:(id)sender {
    NSUInteger selectedOption = mySegmentedControl.selectedSegmentIndex;
    if (selectedOption == upArrowIndex) {
        // swap in "up"-ward view controller
    }
    else if (selectedOption == downArrayIndex) {
        // swap in "down"-ward view controller
    } 
}