实现水平UIRefreshControl [英] Implement a horizontal UIRefreshControl
问题描述
如何实现UIRefreshControl,当从左侧或右侧拉出时会刷新?
How do I go and implement a UIRefreshControl which would get refreshed when pulled from left or right side??
是否可以使用标准的UIRefreshControl?或者是否有任何API来创建此效果?我一直在寻找一些能够获得一些优势,但我无法找到任何东西。
Is it possible with the standard UIRefreshControl? Or is there any API to create this effect? I have been searching a lot to get some lead on this but I am not able to find anything.
我所能找到的只是这个关于SO的答案,但它是用C#编写的,我不太熟悉。
All I could find is this answer on SO, but it is written in C# which I am not much familiar with.
推荐答案
你可以使用旋转90度的UITableViewController。
You could use a UITableViewController that is rotated 90 degrees.
添加 [self.view setTransform:CGAffineTransformMakeRotation(安装过程中UITableViewController类中的-M_PI / 2)];
。
使用UITableView(而不是UITableViewController)的示例:
Example using UITableView (and not UITableViewController):
table_ = [[UITableView alloc] initWithFrame:self.bounds];
[table_ setDelegate:self];
[table_ setDataSource:self];
[table_ registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
[table_ setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
UIRefreshControl *ctrl = [[UIRefreshControl alloc] init];
[ctrl setBackgroundColor:[UIColor yellowColor]];
[table_ addSubview:ctrl];
[self addSubview:table_];
请务必记住以相反方向再次旋转内容!
Make sure to remember to rotate the content back again in the opposite direction!
这篇关于实现水平UIRefreshControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!