Latest 1.0
Homepage https://github.com/westerlund/KeyFrameFold
License MIT
Platforms ios 6.0, requires ARC
Authors

KeyFrameFold

Build Status

keyframefold

KeyFrameFold is a tool to attach to your favourite UIScrollView, it can then be used to hide the UINavigationBar like Safari does on iOS7

Simply add SWKeyFrameFold.h to your project and in your -scrollViewDidScroll: use the following snippet.

[[SWKeyFrameFold shared] foldUsingScrollView:scrollView       // 1
                 totalHeight:44 + 24          // 2
                   keyPoints:@[@0.0f, @44.0f] // 3
                      blocks:@[(SWKeyFrameFoldBlock)^(CGFloat percentDone, BOOL scrollDirectionDown, CGFloat totalPercentDone) {
    NSLog(@"%f", percentDone);
    },
                           (SWKeyFrameFoldBlock)^(CGFloat percentDone, BOOL scrollDirectionDown, CGFloat totalPercentDone) {
    NSLog(@"%f", percentDone);
    }]];
  1. Use the shared instance and attach your scrollView
  2. Calculate the total height the fold will use as reference, the height here is based on a UINavigationBar and a UIToolBar
  3. Add your keyPoints, i.e. when you want your fold to begin
  4. And last, provide your blocks in an NSArray. The block is a SWKeyFrameFoldBlock and returns
    1. CGFloat percentDone the local percent, 0-1 were 1 is folded
    2. BOOL scrollDirectionDown if the user is scrolling down
    3. CGFloat totalPercentDone the total percent of the folding, 0-1 were 1 is folded.

Latest podspec

{
    "name": "SWKeyFrameFold",
    "version": "1.0",
    "summary": "KeyFrameFold is a tool to attach to your favourite UIScrollView, it can then be used to hide the UINavigationBar like Safari does on iOS7",
    "authors": {
        "Simon Westerlund": "[email protected]"
    },
    "homepage": "https://github.com/westerlund/KeyFrameFold",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "source": {
        "git": "https://github.com/westerlund/KeyFrameFold.git",
        "tag": "1.0"
    },
    "source_files": "SWKeyFrameFold/*.{h,m}",
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This