我有一个初始表unreadmessagesArrays,女巫完美显示。 但是想要滚动到底部并加载另一行数据.. 我用过这个:
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
CGFloat currentOffset = scrollView.contentOffset.y;
CGFloat maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
if (maximumOffset - currentOffset <= 10.0) {
[self insertRowInTableView];
}
}
-(void)insertRowInTableView {
[self.unreadmessagesArray addObject:self.messagesIfScroll];
[mytableView beginUpdates];
NSArray *paths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:([self.unreadmessagesArray count] - 1) inSection:0]];
[mytableView insertRowsAtIndexPaths:paths withRowAnimation:NO];
[mytableView endUpdates];
[mytableView reloadData];
}
-(void)getMessagesIfScollToBottom {
self.messagesIfScroll = [NSMutableArray arrayWithArray:responseA];
}
我得到的错误是:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI addObject:]: unrecognized selector sent to instance 0xa20b620'
问题出在哪里? 谢谢
答案 0 :(得分:0)
在您的代码中使用此代码
[self.unreadmessagesArray addObjectsFromArray:self.messagesIfScroll];
而不是[self.unreadmessagesArray addObject:self.messagesIfScroll];