gpt4 book ai didi

ios - 拉动刷新不会在表格 View 中显示文本或图片

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

我导入了https://github.com/leah/PullToRefresh到我的项目。它的工作原理如下:我可以拉下我的表格 View ,它会自行刷新。问题是我在刷新时没有收到任何文本或箭头。我尝试导入它并对其进行子类化(有效,但没有文本或箭头)。我直接将其实现到我的类(class)中(仍然有效,但没有文本或箭头)。希望有人有解决办法。

这是我在类里面的称呼:

在我的 .h 文件中导入它

#import "PullRefreshTableViewController.h"

并对其进行子类化

@interface Friends : PullRefreshTableViewController

在我的 .m 文件中,我按照指示进行操作并添加:

-(void)refresh {

[self performSelector:@selector(doXMLParsing) withObject:nil afterDelay:1.0];}

并放置

[self stopLoading];

在我的方法的末尾。

它做了它应该做的事情,遗憾的是没有显示文本或箭头。

最佳答案

使用下面的代码可以简单地在 tableView 中应用拉动刷新。

在 View Controller 的头文件中将refreshControl声明为:-

UIRefreshControl *refreshControl;

并在实现文件中使用为:-

refreshControl=[[UIRefreshControl alloc] init];
refreshControl.tintColor=t.tableCellSelectionColor;
[refreshControl setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Refresh Title"]];//Optional

[refreshControl addTarget:self action:@selector(reloadTable) forControlEvents:UIControlEventValueChanged];
[tblView addSubview:refreshControl];

-(void)reloadTable
{
// do your stuff here....
[tblView reloadData];
[refreshControl endRefreshing];
}

关于ios - 拉动刷新不会在表格 View 中显示文本或图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9566663/

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