开发者

Table-view rows

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:(NSIn开发者_Python百科teger)section

return the right number of rows that it should show


Set the table footerView to a view that doesn't render anything (but not nil).

tableView.tableFooterView = [[[UIView allocate] init] autorelease];


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.


You've got the right place and really have the answer already. Here it is in code: try it may be helped....

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return totalRows; } totalRows= (you want so no. of rows )

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 }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜