为 UIRefreshControl 提供顶部插图

编程入门 行业动态 更新时间:2024-10-23 13:29:04
本文介绍了为 UIRefreshControl 提供顶部插图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用类似的 UIRefreshControl(没有 UITableViewController):

I use an UIRefreshControl like it (without an UITableViewController) :

UIRefreshControl *refreshControl = [UIRefreshControl new]; [refreshControl addTarget:self action:@selector(viewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged]; [self.table addSubview:refreshControl];

问题是刷新轮位于 UINavigationController 的半透明栏下方 (ios7).StackOverflow 上关于这个问题的话题很少.而且他们没有给我带来任何有价值的解决方案.

Problem is the refresh wheel is positioned below the UINavigationController's translucent bar (ios7). There is only a few topic on this problem on StackOverflow. And they didn't bring any valuable solution to me.

例如,我希望将 UIRefreshControl 的 y 位置向下 80px.

What I wish is to make my UIRefreshControl's y position 80px down for example.

注意:我知道不建议在 UITableViewController 之外使用 UIRefreshControl.所以不需要警告它.

Note : I know it's not recommended to use UIRefreshControl outside an UITableViewController. So no need to warn about it.

推荐答案

我找到了一个解决方案,非常简单,不是很干净,但效果很好.

I found a solution, very simple, not so clean but works like a charm.

只需要将刷新控件放在另一个设置的子视图中即可.

Just need to put the refresh control in another subview which is set down.

UIView *refreshView = [[UIView alloc] initWithFrame:CGRectMake(0, 80, 0, 0)]; [self.table addSubview:refreshView]; UIRefreshControl *refreshControl = [UIRefreshControl new]; [refreshControl addTarget:self action:@selector(viewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged]; [refreshView addSubview:refreshControl];

更多推荐

为 UIRefreshControl 提供顶部插图

本文发布于:2023-11-25 12:07:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629681.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插图   UIRefreshControl

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!