Created
June 26, 2011 18:51
-
-
Save yllan/1047853 to your computer and use it in GitHub Desktop.
Step support two directions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void (^((^step)(CGFloat, CGFloat, CGFloat)))(void (^)(CGFloat)) = ^(CGFloat begin, CGFloat end, CGFloat delta) { | |
| if (begin <= end) { | |
| return (void (^)(void (^)(CGFloat)))[[^(void (^block)(CGFloat)) { | |
| for (CGFloat v = begin; v < end; v += delta) { | |
| block(v); | |
| } | |
| } copy] autorelease]; | |
| } else { | |
| return (void (^)(void (^)(CGFloat)))[[^(void (^block)(CGFloat)) { | |
| for (CGFloat v = begin; v >= end; v -= delta) { | |
| block(v); | |
| } | |
| } copy] autorelease]; | |
| } | |
| }; | |
| step(fromProgress, toProgress, 0.025)(^(CGFloat progress) { | |
| // something must be wrong | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment