我在表格視圖中使用下面的代碼來顯示最後一行但是這裏的問題是,在使用這個時我無法滾動表格。我爲此搜索了很多,但我沒有找到解決這個問題的方法。任何人都可以提出一些建議如何解決這個問題。UITable查看不重新加載
- (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
// here to draw cell ImageCell is used for customise cell.
ImageCell *cell = (ImageCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; // changed this
if (cell == nil) {
cell = [[[ImageCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease]; // changed this
}
cell.selectionStyle=UITableViewCellSelectionStyleNone;
// setting the text
NSDictionary *messageData = [messageArray objectAtIndex:[indexPath row]];
[cell setData:messageData];
int lastRowNumber = [tableView numberOfRowsInSection:0]-1;
NSIndexPath* ip = [NSIndexPath indexPathForRow:lastRowNumber inSection:0];
[tableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionNone animated:YES];
// Set up the cell
return cell;
}
這是我的代碼。
你是什麼意思「不能滾動表」嗎?另外,爲了重新載入表格,你需要在某個時候調用'reloadData',而這個地方不會調用你提供的東西。 – WrightsCS
是的,我無法看到上面的單元格數據。實際上我是在繪製表格 – Vijay
時寫入了這個代碼,「上面的單元格數據」也沒有意義。要麼提供更多的isse或更多代碼的背景。 – WrightsCS