我使用一个tableview中显示一条消息,我用下面[UITableView的_contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]
UIView *chatView = [self bubbleView:[NSString stringWithFormat:@"%@", message] from:YES];
[self.chatArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:message, @"text", @"self", @"speaker", chatView, @"view", nil]];
[self.chatTableView reloadData];
[self.chatTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.chatArray count]-1 inSection:0]
atScrollPosition: UITableViewScrollPositionBottom
animated:YES];
的代码和我得到以下
[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (0) beyond bounds (0) for section (0).'
给出的错误plz帮助我在解决这个问题
也许将'[NSIndexPath indexPathForRow:[self.chatArray count] -1 inSection:0]'设置为一个变量并在调用'scrollToRowAtIndexPath'之前检查它的值。确保所有值都是他们应该是的 – 2014-10-30 07:40:55