如何使用UISegmentedControl检查选择了哪个段

时间:2013-08-21 08:57:12

标签: ios objective-c camera uiimagepickercontroller uisegmentedcontrol

我有一个UIImagePicker,当你点击一个按钮时,虽然我最近添加了一个使用段的选项,你可以使用相机虽然我似乎无法检查选择了哪个段。这是我到目前为止的代码:

- (IBAction)addPicture:(id)sender {
    if (_photoControl.selected == 0) {
        CGRect rect = CGRectMake(0, 0, 753, 118);
        [popOverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    } else {

    }
}

虽然if语句总是如此。

虽然我很难过,但这可能是显而易见的。

提前致谢

1 个答案:

答案 0 :(得分:3)

使用selectedSegmentIndex,而不是selected