Am using following code in table view for showing last row But here problem is that while using this am unable to scroll the table. I search lot for this but I didn't find the way to solve this question . can anyone give some suggestion how to solve this.
- (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开发者_JS百科 cell
return cell;
}
This is my code.
atScrollPosition:UITableViewScrollPositionNone
is your culprit, use UITableViewScrollPositionBottom
or UITableViewScrollPositionTop
精彩评论