向 UITableView 添加拉动刷新功能

发布于 2025-01-01 05:13:30 字数 686 浏览 6 评论 0原文

我有一个 UIViewCOntroller,并且我向其中添加了 2 个表视图和 3 个文本字段。 UI视图控件的顺序如下;

1.) tableview - A - 出现在前 1/2 2.) 文本字段 3.) tableVIew - B

我需要将 pullTorefresh 功能添加到 B tableView,我该怎么做。我已经尝试了几个库(PullToRefreshEGOTableViewPullRefresh

有人能给我适合我的场景的示例代码吗?

像这样的图像,(图像显示部分,但是我使用单独的 Tableviews 完成了我的操作,并且我的在 2 个 tableview 之间有 3 个文本字段。我需要第二个 tableview 才能具有 PullToRefresh 功能。

注意:请不要告诉我尝试 PullToRefreshEGOTableViewPullRefresh,它不能解决我的情况。但是,如果您尝试过并且有效,请帮助我。

I have a UIViewCOntroller, and i have added 2 tableviews, and 3 textfields to it. The order of UI view controls are as follows;

1.) tableview - A - present in the first 1/2
2.) textFields
3.) tableVIew - B

I need to add the pullTorefresh functionality to the B tableView, How can i do this. I have tried several libraries (PullToRefresh, EGOTableViewPullRefresh)

Can someone give me sample code which suits my scenario.

Something like this image, (the image shows Sections, but i have done mine using seperate Tableviews, and mine has 3 textfields in between the 2 tableview). I need the 2nd tableview to have the PullToRefresh functionality.

note: Please don't tell me to try PullToRefresh, EGOTableViewPullRefresh and it doesn't address my scenario. But, if you had tried it and if it works please do help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光沙漏 2025-01-08 05:13:30

iOS 6 添加了新的控件 - 可用于 UITableViewControllers 的下拉刷新控件。

在 ViewDidLoad 中添加以下代码-

- (void)viewDidLoad
{

   UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];

   [refreshControl addTarget:self action:@selector(refresh)    
   forControlEvents:UIControlEventValueChanged];

   [self.tableViewB addSubview:refreshControl];
}

- (void)refresh 
{

    //write your code here

    // for example

    [self.tableViewB reloadData];

}

-(void)stopLoading
{ 

     //after completing your action,stop loading now

     [refreshControl endRefreshing];   

}

iOS 6 added new control - pull-to-refresh control available for UITableViewControllers.

add following code in ViewDidLoad-

- (void)viewDidLoad
{

   UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];

   [refreshControl addTarget:self action:@selector(refresh)    
   forControlEvents:UIControlEventValueChanged];

   [self.tableViewB addSubview:refreshControl];
}

- (void)refresh 
{

    //write your code here

    // for example

    [self.tableViewB reloadData];

}

-(void)stopLoading
{ 

     //after completing your action,stop loading now

     [refreshControl endRefreshing];   

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文