Actually what i am doing is here
(void)createTable{
mainTableView = [[UITableView alloc]initWithFrame:CGRectMake(x, 0, width, 450) style:UITableViewCellSelectionStyleNone];
mainTableView.scrollEnabled= NO;
mainTableView.delegate = self;
mainTableView.dataSource = self;
mainTableView.allowsSelection = NO;
mainTableView.tag = i;
x=x+width+1;
CGRect frame ;
frame = axistableView.frame;
frame.size.width = x;
frame.size.height = 450;
axistableView.frame = frame;
scrollView.contentSize = axistableView.bounds.size;
[axistableView addSubview:mainTableView];
开发者_JAVA百科 i++;
}
i want to delete all tables.For that i am using following codes.But it remove only last created table.
-(void)removeTable
{
[mainTableView removeFromSuperview];
}
please check this. thanks.
You can use this code to remove all tables from a view
for(UIView *v in self.view.subviews) {
if([v isKindOfClass:[UITableView class]]) {
[v removeFromSuperview];
}
}
精彩评论