2014-10-17 38 views
0

我有一个初始表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

在代码中使用这个代码

[self.unreadmessagesArray addObjectsFromArray:self.messagesIfScroll];

,而不是[self.unreadmessagesArray addObject:self.messagesIfScroll];

+0

同样的问题! – lyn87 2014-10-17 17:06:55

+0

'unreadmessagesArray'的类型是什么?这是NSMutableArray还是NSArray? – 2014-10-18 05:43:18

+0

都是unreadmessageaArray,而messagesIfScroll是NSMutalearray! – lyn87 2014-10-19 12:17:39

相关问题