Ios 在按钮单击操作上加载tableview的步骤

Ios 在按钮单击操作上加载tableview的步骤,ios,Ios,案例3: 这是我的代码,我无法将我的内容从数组加载到表视图。当我在所有按钮之间切换时,我会看到上一个视图的内容重叠。 请帮助我。提前谢谢。这是您的按钮操作方法吗?是的,这是我的按钮操作方法。您在哪里删除了这些子视图?在另一种方法中,我有3个按钮,其中一个操作。我必须在程序第一次执行时加载视图。然后,我必须根据您调用的按钮按下的ID加载其余视图[tableView重新加载数据]? view1.hidden = YES; view2.hidden = YES;

案例3:

这是我的代码,我无法将我的内容从数组加载到表视图。当我在所有按钮之间切换时,我会看到上一个视图的内容重叠。
请帮助我。提前谢谢。

这是您的按钮操作方法吗?是的,这是我的按钮操作方法。您在哪里删除了这些子视图?在另一种方法中,我有3个按钮,其中一个操作。我必须在程序第一次执行时加载视图。然后,我必须根据您调用的按钮按下的ID加载其余视图[tableView重新加载数据]?
        view1.hidden = YES;
        view2.hidden = YES;
        view4.hidden = NO;
        view2 = [[UIView alloc]init];
        view1 = [[UIView alloc]init];
        [offerButton setBackgroundColor:UIColorFromRGB(0xeb8100)];
        [organisationButton setBackgroundColor:UIColorFromRGB(0xeb8100)];
        [locationButton setBackgroundColor:UIColorFromRGB(0xb47433)];

        view4 = [[UIView alloc]initWithFrame:CGRectMake(amphorosTextView.frame.origin.x, offerButton.frame.origin.y+offerButton.frame.size.height +5, 302,120)];
        view4.backgroundColor = [UIColor clearColor];


        [mainScrollView addSubview:view4];
        CGFloat x = 0;
        CGFloat y = 0;
        CGFloat width = view4.frame.size.width;
        CGFloat height = view4.frame.size.height;
        CGRect tableFrame = CGRectMake(x, y, width, height);

        UITableView *tableView = [[UITableView alloc]initWithFrame:tableFrame style:UITableViewStyleGrouped];

        //tableView.rowHeight = 45;
        // tableView.sectionFooterHeight = 22;
        // tableView.sectionHeaderHeight = 22;
        tableView.scrollEnabled = YES;
        tableView.showsVerticalScrollIndicator = YES;
        tableView.userInteractionEnabled = YES;
        tableView.bounces = YES;
        tableView.backgroundColor = [UIColor cyanColor];
        tableView.delegate = self;
        tableView.dataSource = self;
        [view4 addSubview:tableView];

        offerButton.selected = NO;
        organisationButton.selected = NO;
        locationButton.selected = YES;

        break;

}