I have a UITableView
which I am loading it with NSMutableArray
. I want the extra rows to be removed i.e I want only the count number of objects in the array
to be displayed as rows. If I have 3 objects in the array
I want only 3 rows to be displayed in UITableView
.But I can see the extra empty rows are also added in addition to the count number of objects in the array
.How can I do it?
Use it may be helpful for you :)
- (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
// This will create a "invisible" footer
return 0.01f;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
// To "clear" the footer view
return [[UIView new] autorelease];
}
OR Use it.....
self.tblView=[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,370) style:UITableViewStylePlain];
self.tblView.delegate=self;
self.tblView.dataSource=self;
[self.view addSubview:self.tblView];
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)];
v.backgroundColor = [UIColor clearColor];
[self.tblView setTableHeaderView:v];
[self.tblView setTableFooterView:v];
[v release];