Ios7 UISegmentedControl未对编程添加的段触发事件

Ios7 UISegmentedControl未对编程添加的段触发事件,ios7,uisegmentedcontrol,Ios7,Uisegmentedcontrol,我正在代码中创建一个UISegementedControl,并使用目标/动作对该控件进行一些自定义动画。问题是,轻触新添加的段时,不会触发任何事件。以下是UI分段控件的设置代码: _controlView = [[UISegmentedControl alloc] initWithItems:@[@"$100"]]; [_controlView addTarget:self action:@selector(controlViewTapped:) forControlEvents:UIContr

我正在代码中创建一个UISegementedControl,并使用目标/动作对该控件进行一些自定义动画。问题是,轻触新添加的段时,不会触发任何事件。以下是UI分段控件的设置代码:

_controlView = [[UISegmentedControl alloc] initWithItems:@[@"$100"]];
[_controlView addTarget:self action:@selector(controlViewTapped:) forControlEvents:UIControlEventValueChanged];
和操作处理程序:

-(void)controlViewTapped:(id)sender{
    NSLog(@"Control was tapped: %@", sender);
    if (!_isExpanded) {
        _isExpanded = YES;
        [UIView animateWithDuration:0.5 animations:^{
            [_controlView setTitle:self.expandedText forSegmentAtIndex:0];
            [_controlView insertSegmentWithTitle:@"Size 10" atIndex:1 animated:YES];
            [_controlView setContentOffset:_offset forSegmentAtIndex:1];
            [_controlView setEnabled:YES forSegmentAtIndex:1];
        }];
    } else {
        _isExpanded = NO;
        [UIView animateWithDuration:0.5 animations:^{
            [_controlView setTitle:self.collapsedText forSegmentAtIndex:0];
            [_controlView removeSegmentAtIndex:1 animated:YES];
        }];
    }
    [self setNeedsDisplay];
}
展开视图时,点击第二段时不会触发任何事件。我尝试过删除并重新添加目标,使用轻触手势识别器并删除/重新添加它,但没有效果。有什么建议吗