Reputation: 1070
Hey guys when I show talbeview there are a lot of empty rows... How can I make the number of rows shown exactly equal to [NSARRAY COUNT]
I am sure
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
return the right number of rows that it should show
Upvotes: 1
Views: 186
Reputation: 1766
You've got the right place and really have the answer already. Here it is in code: try it may be helped....
and
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [NSString stringWithFormat:@"%i %i",indexPath.row,indexPath.section]; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryNone; cell.accessoryType = UITableViewCellAccessoryNone; cell.highlighted = YES }
Upvotes: 0
Reputation: 39512
Set the table footerView to a view that doesn't render anything (but not nil).
tableView.tableFooterView = [[[UIView allocate] init] autorelease];
Upvotes: 2
Reputation: 22305
You've got the right place and really have the answer already. Here it is in code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [yourDataArrayName count];
}
Substitute the actual name of your table for tableView and the actual name of your array for yourDataArrayName, obviously.
Upvotes: 0