根据选择器视图部分隐藏表视图

Hide tableview based on picker view section

我想显示基于选择器视图的隐藏表视图 selection.In 选择器视图 我有一个包含四个值的数组。如果我 select value(2) tableview 可以隐藏,否则它会隐藏。

下面是选择器视图代码:

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
{
    textfie.text = [NSString stringWithFormat:@"%@",[arrMsg objectAtIndex:row]];


    NSLog([arrmsg1 objectAtIndex:row]);
    NSLog(@"%@",json);

}

你可以这样做,

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    textfie.text = [NSString stringWithFormat:@"%@",[arrMsg objectAtIndex:row]];

    if (row == 1) {

        self.myTableview.hidden = YES;
    }


    NSLog([arrmsg1 objectAtIndex:row]);
    NSLog(@"%@",json);

 }

希望这会有所帮助:)

尝试使用 tableview alpha 为零。

检查下面的代码

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
{
[UIView animateWithDuration:0.25 animations:^{
    if (row == 3) {
        self.yourableView.alpha = 0.0;
    }
    else{
        self.yourTableView.alpha = 1.0;

    }
}];

}