gpt4 book ai didi

iphone - EGOTableViewPullRefresh 与 GMGridView 集成时不刷新并显示向上箭头

转载 作者:行者123 更新时间:2023-11-29 04:09:29 26 4
gpt4 key购买 nike

我需要在https://github.com/gmoledina/GMGridView中添加下拉刷新效果GMGridView!所以我只是将 GMGridView 与 EGOTableViewPullRefresh 集成在我的 viewController 中,但事实证明没有新鲜效果,并且当我拉刷新标题 View 时不显示向上箭头。以下是我的 viewController 中的一些代码片段:

- (void)loadView
{
[super loadView];

self.view.backgroundColor = [UIColor whiteColor];
NSInteger spacing = INTERFACE_IS_PHONE ? 5 : 15;

GMGridView *gmGridView = [[GMGridView alloc] initWithFrame:self.view.bounds];
gmGridView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
gmGridView.backgroundColor = [UIColor clearColor];
[self.view addSubview:gmGridView];
_gmGridView = gmGridView;

_gmGridView.style = GMGridViewStyleSwap;
_gmGridView.itemSpacing = spacing;
_gmGridView.minEdgeInsets = UIEdgeInsetsMake(spacing, spacing, spacing, spacing);
_gmGridView.centerGrid = YES;
_gmGridView.actionDelegate = self;
_gmGridView.sortingDelegate = self;
_gmGridView.transformDelegate = self;
_gmGridView.dataSource = self;

}

- (void)viewDidLoad
{
[super viewDidLoad];

if (_refreshHeaderView == nil) {

EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.gmGridView.bounds.size.height, self.view.frame.size.width, self.gmGridView.bounds.size.height)];
view.delegate = self;
[self.gmGridView addSubview:view];
_refreshHeaderView = view;
[view release];

}
[_refreshHeaderView refreshLastUpdatedDate];
}


- (void)scrollViewDidScroll:(UIScrollView *)scrollView{

[_refreshHeaderView egoRefreshScrollViewDidScroll:scrollView];

}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{

[_refreshHeaderView egoRefreshScrollViewDidEndDragging:scrollView];

}

- (void)reloadTableViewDataSource{

// should be calling your tableviews data source model to reload
// put here just for demo
_reloading = YES;

}

- (void)doneLoadingTableViewData{
_reloading = NO;
[_refreshHeaderView egoRefreshScrollViewDataSourceDidFinishedLoading:self.gmGridView];

}


- (void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view{

NSLog(@"egoRefreshTableHeaderDidTriggerRefresh");
[self reloadTableViewDataSource];
[self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0];

}

- (BOOL)egoRefreshTableHeaderDataSourceIsLoading:(EGORefreshTableHeaderView*)view{

NSLog(@"egoRefreshTableHeaderDataSourceIsLoading");
return _reloading; // should return if data source model is reloading

}
- (NSDate*)egoRefreshTableHeaderDataSourceLastUpdated:(EGORefreshTableHeaderView*)view{

return [NSDate date]; // should return date data source was last changed

}

最佳答案

我已经解决了这个问题: 需要让viewController确认到UIScrollViewDelegate并添加

    _gmGridView.delegate = self;

在viewController的loadView方法中。

关于iphone - EGOTableViewPullRefresh 与 GMGridView 集成时不刷新并显示向上箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14642739/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com