SegmentControl点击切换View

[segmentControl_ addTarget:self action:@selector(segmentChangedValue:) forControlEvents:UIControlEventValueChanged];

- (void)segmentChangedValue:(id)sender {
    switch([(UISegmentedControl *)sender selectedSegmentIndex])
    {
        case 0:
            [viewSelectedController_.view removeFromSuperview];
            [self.view addSubview:viewAllController_.view];
            break;
            
        case 1:
            [viewAllController_.view removeFromSuperview];
            [self.view addSubview:viewSelectedController_.view];
            
            break;
            
        
        default:
            
            break;
    }

}


你可能感兴趣的:(action)