[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:] [英] [UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]

查看:1819
本文介绍了[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用tableview显示消息,我使用下面的代码

I am using a tableview to display a message and i used the code below

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帮助我解决这个问题

plz help me in solving this

推荐答案

在我看来,你的表视图还没有任何行或部分。我想到了两种可能性。

Seems to me that your table view does not have any rows or sections in yet. Two possibilities come to my mind.


  1. 检查 numberOfRowsInSection 委托和 numberOfSectionsInTableView 以便它们不会设置为0.

  2. 可能 tableview 有尚未完成加载数据。

  1. Check your numberOfRowsInSection delegate and numberOfSectionsInTableView so that they are not set to 0.
  2. Its possible that the tableview has not yet finished loading the data.

请分享您的发现,以便我可以在需要时提供更多帮助。

Do share your findings, so I might be able to help out further if needed.

这篇关于[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆