benmathia/BOZPongRefreshControl
benmathia/BOZPongRefreshControl has 874 GitHub stars and 64 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-24 08:53 UTC. Last push 2015-01-13.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
关于
一个会玩 Pong 的 iOS 下拉刷新控件,最初为 MHacks III iOS 应用创建。
开发工具README.md
原文BOZPongRefreshControl
A pull-down-to-refresh control for iOS that plays pong

Installation
It's on CocoaPods! Put pod 'BOZPongRefreshControl' in your Podfile.
Alternatively, just place BOZPongRefreshControl.h and BOZPongRefreshControl.m in your project anywhere you'd like.
Usage
Attach it to a UITableView or UIScrollView like so:
- (void)viewDidLoad
{
[super viewDidLoad];
/* NOTE: Do NOT attach the refresh control in viewDidLoad!
* If you do this here, it'll act very funny if you have
* a navigation bar or other such similar thing that iOS
* automatically offsets content for. You have to wait for
* the subviews to get laid out first so the refresh
* control knows how big that offset is!
*/
}
- (void)viewDidLayoutSubviews
{
self.pongRefreshControl = [BOZPongRefreshControl attachToTableView:self.tableView
withRefreshTarget:self
andRefreshAction:@selector(refreshTriggered)];
}
Then, implement UIScrollViewDelegate in your UIViewController if you haven't already, and pass the calls through to the refresh control:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self.pongRefreshControl scrollViewDidScroll];
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
[self.pongRefreshControl scrollViewDidEndDragging];
}
Lastly, make sure you've implemented the refreshAction you passed it earlier to listen for refresh triggers:
- (void)refreshTriggered
{
//Go and load some data
//Finshed loading the data, reset the refresh control
[self.pongRefreshControl finishedLoading];
}
For more details, check out the demo app's code. It has examples for using the refresh control on a UIScrollView and outside of a UITableViewController.
Configuration
- Set the foreground color with the
foregroundColorproperty - Set the background color with the
backgroundColorproperty - Adjust how fast it plays by changing the
totalHorizontalTravelTimeForBallproperty
Known Issues/To Do
- It'll interfere with
UIScrollViewcontent that's abovey = 0.0f - I haven't tested it, but I'd be willing to bet it looks a bit silly on iPads
- Test it out on a physical iPhone 6+
- The behavior of the paddles needs a little work
- The the
UIScrollViewthat it's attached to is scrolled automatically, the refresh control may be scrolled down into view under some circumstances (expanding/collapsingUITableViewCells, for example) - Tests!
探索相关项目
加载中…