Uitableview 滚动到底部后在表视图中加载数据
我有一个初始表UnderMessagesArray,它显示得非常完美。 但a希望滚动到底部并加载另一行数据。。 我用了这个:Uitableview 滚动到底部后在表视图中加载数据,uitableview,uiscrollview,Uitableview,Uiscrollview,我有一个初始表UnderMessagesArray,它显示得非常完美。 但a希望滚动到底部并加载另一行数据。。 我用了这个: - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ CGFloat currentOffset = scrollView.contentOffset.y; CGFloat maximumOffset = scrollView.conten
- (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];
}
-(void)ScrollViewDiEndDraging:(UIScrollView*)scrollView将减速:(BOOL)减速{
CGFloat currentOffset=scrollView.contentOffset.y;
CGFloat maximumOffset=scrollView.contentSize.height-scrollView.frame.size.height;
如果(maximumOffset-currentOffset在代码中,请使用此代码
[self.unreadmessagesArray addObjectsFromArray:self.messagesIfScroll];
而不是[self.UnderMessageArray addObject:self.messagesIfScroll];
什么是“UnderMessageArray”类型?这是NSMutableArray还是NSArray?UnderMessageArray和messagesIfScroll都是NSMutableArray!感谢尝试:-)