├── images
└── image1.jpg
├── Example
├── IBScrollViewFloatingHeader
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── IBAppDelegate.h
│ ├── main.m
│ ├── IBScrollViewFloatingHeader-Prefix.pch
│ ├── IBViewController.h
│ ├── IBScrollViewFloatingHeader
│ │ ├── UIScrollView+IBFloatingHeader.h
│ │ └── UIScrollView+IBFloatingHeader.m
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── LaunchImage.launchimage
│ │ │ └── Contents.json
│ ├── IBScrollViewFloatingHeader-Info.plist
│ ├── IBViewController.m
│ ├── IBAppDelegate.m
│ └── Base.lproj
│ │ ├── Main_iPhone.storyboard
│ │ └── Main_iPad.storyboard
└── IBScrollViewFloatingHeader.xcodeproj
│ ├── project.xcworkspace
│ └── contents.xcworkspacedata
│ └── project.pbxproj
├── .gitignore
├── IBScrollViewFloatingHeader
├── UIScrollView+IBFloatingHeader.h
└── UIScrollView+IBFloatingHeader.m
├── README.md
└── LICENSE.md
/images/image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ivanbruel/IBScrollViewFloatingHeader/HEAD/images/image1.jpg
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | .DS_Store
3 | */build/*
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | profile
14 | *.moved-aside
15 | DerivedData
16 | .idea/
17 | *.hmap
18 | *.xccheckout
19 |
20 | #CocoaPods
21 | Pods
22 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // IBAppDelegate.h
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface IBAppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "IBAppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([IBAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBScrollViewFloatingHeader-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_5_0
10 | #warning "This project uses features only available in iOS SDK 5.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 | #endif
17 |
--------------------------------------------------------------------------------
/IBScrollViewFloatingHeader/UIScrollView+IBFloatingHeader.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIScrollView+IBFloatingHeader.h
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIScrollView (IBFloatingHeader)
12 |
13 | @property(nonatomic,retain) UIView* floatingHeaderView;
14 |
15 | -(void)removeContentOffsetObserver;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // IBViewController.h
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UIScrollView+IBFloatingHeader.h"
11 | @interface IBViewController : UIViewController{
12 | NSArray* array;
13 | }
14 |
15 | @property (strong, nonatomic) IBOutlet UITableView *tableView;
16 | @end
17 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBScrollViewFloatingHeader/UIScrollView+IBFloatingHeader.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIScrollView+IBFloatingHeader.h
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIScrollView (IBFloatingHeader)
12 |
13 | @property(nonatomic,retain) UIView* floatingHeaderView;
14 |
15 | -(void)removeContentOffsetObserver;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "ipad",
20 | "size" : "29x29",
21 | "scale" : "1x"
22 | },
23 | {
24 | "idiom" : "ipad",
25 | "size" : "29x29",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "ipad",
30 | "size" : "40x40",
31 | "scale" : "1x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "40x40",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "76x76",
41 | "scale" : "1x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "76x76",
46 | "scale" : "2x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | },
18 | {
19 | "orientation" : "portrait",
20 | "idiom" : "ipad",
21 | "extent" : "full-screen",
22 | "minimum-system-version" : "7.0",
23 | "scale" : "1x"
24 | },
25 | {
26 | "orientation" : "landscape",
27 | "idiom" : "ipad",
28 | "extent" : "full-screen",
29 | "minimum-system-version" : "7.0",
30 | "scale" : "1x"
31 | },
32 | {
33 | "orientation" : "portrait",
34 | "idiom" : "ipad",
35 | "extent" : "full-screen",
36 | "minimum-system-version" : "7.0",
37 | "scale" : "2x"
38 | },
39 | {
40 | "orientation" : "landscape",
41 | "idiom" : "ipad",
42 | "extent" : "full-screen",
43 | "minimum-system-version" : "7.0",
44 | "scale" : "2x"
45 | }
46 | ],
47 | "info" : {
48 | "version" : 1,
49 | "author" : "xcode"
50 | }
51 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | IBScrollViewFloatingHeader
2 | ==========================
3 |
4 | This project is inspired by Facebook's Floating Header View on iOS.
5 |
6 | The header view will float on the top on two cases:
7 | - ScrollView is scrolled all the way to the top;
8 | - User scrolled up faster than a normal scroll.
9 |
10 |
11 |
12 | This is supposed to work on iOS 5+.
13 |
14 | Supported Views:
15 |
16 | - UIScrollView
17 | - UITableView
18 | - UICollectionView -- ***untested***
19 |
20 | ## Usage
21 | Add UIScrollView+IBFloatingHeader.h and UIScrollView+IBFloatingHeader.m to your Xcode project.
22 |
23 | Import UIScrollView+IBFloatingHeader.h on your desired UIViewController.
24 |
25 | #import "UIScrollView+IBFloatingHeader.h"
26 |
27 | Create a custom UIView and set it as the floating header for the UIScrollView/UITableView of your choice.
28 |
29 | UIView* header = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen]bounds].size.width, 40)];
30 | [header setBackgroundColor:[UIColor redColor]];
31 | [self.scrollView setFloatingHeaderView:header];
32 |
33 | In your view controller, add:
34 | `- (void)viewWillDisappear:(BOOL)animated {
35 | [self.tableView removeContentOffsetObserver];
36 | }`
37 |
38 | Access the floating view by sending the floatingHeaderView message to the UIScrollView/UITableView
39 |
40 | UIView* floatingHeaderView = [self.tableView floatingHeaderView];
41 |
42 | ### Known Issues
43 | None yet.
44 |
45 | ### Contributions
46 | - Contributions and suggestions are welcome.
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBScrollViewFloatingHeader-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.ivan.bruel.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIMainStoryboardFile
28 | Main_iPhone
29 | UIMainStoryboardFile~ipad
30 | Main_iPad
31 | UIRequiredDeviceCapabilities
32 |
33 | armv7
34 |
35 | UISupportedInterfaceOrientations
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationLandscapeLeft
39 | UIInterfaceOrientationLandscapeRight
40 |
41 | UISupportedInterfaceOrientations~ipad
42 |
43 | UIInterfaceOrientationPortrait
44 | UIInterfaceOrientationPortraitUpsideDown
45 | UIInterfaceOrientationLandscapeLeft
46 | UIInterfaceOrientationLandscapeRight
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // IBViewController.m
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import "IBViewController.h"
10 |
11 | @interface IBViewController ()
12 |
13 | @end
14 |
15 | @implementation IBViewController
16 |
17 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
18 | return array.count;
19 | }
20 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
21 | UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
22 | if(cell == nil){
23 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
24 | }
25 | [cell.textLabel setText:array[indexPath.row]];
26 | return cell;
27 | }
28 | - (void)viewDidLoad
29 | {
30 | [super viewDidLoad];
31 | array = [NSArray arrayWithObjects: @"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow",@"Red", @"Green", @"Blue", @"Yellow", nil];
32 |
33 | UIView* header = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen]bounds].size.width, 40)];
34 | [header setBackgroundColor:[UIColor redColor]];
35 | [self.tableView setFloatingHeaderView:header];
36 | // Do any additional setup after loading the view, typically from a nib.
37 | }
38 |
39 | - (void)didReceiveMemoryWarning
40 | {
41 | [super didReceiveMemoryWarning];
42 | // Dispose of any resources that can be recreated.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // IBAppDelegate.m
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import "IBAppDelegate.h"
10 |
11 | @implementation IBAppDelegate
12 |
13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14 | {
15 | // Override point for customization after application launch.
16 | return YES;
17 | }
18 |
19 | - (void)applicationWillResignActive:(UIApplication *)application
20 | {
21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
23 | }
24 |
25 | - (void)applicationDidEnterBackground:(UIApplication *)application
26 | {
27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29 | }
30 |
31 | - (void)applicationWillEnterForeground:(UIApplication *)application
32 | {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | - (void)applicationDidBecomeActive:(UIApplication *)application
37 | {
38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application
42 | {
43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/Base.lproj/Main_iPhone.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/Base.lproj/Main_iPad.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/IBScrollViewFloatingHeader/UIScrollView+IBFloatingHeader.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIScrollView+IBFloatingHeader.m
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import "UIScrollView+IBFloatingHeader.h"
10 | #import
11 |
12 | static void * IBFloatingHeaderViewKey = &IBFloatingHeaderViewKey;
13 | static void * IBFloatingHeaderViewContext = &IBFloatingHeaderViewContext;
14 |
15 | @implementation UIScrollView (IBFloatingHeader)
16 |
17 | #pragma mark - Setters/Getters
18 | -(UIView *)floatingHeaderView{
19 | return objc_getAssociatedObject(self, IBFloatingHeaderViewKey);
20 | }
21 |
22 | -(void)setFloatingHeaderView:(UIView *)headerView{
23 | [self _handlePreviousHeaderView];
24 |
25 | objc_setAssociatedObject(self, IBFloatingHeaderViewKey, headerView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
26 |
27 | [self _handleNewHeaderView];
28 | }
29 | #pragma mark - Handle add/remove of views;
30 | -(void)_handlePreviousHeaderView{
31 | UIView* previousHeaderView = [self floatingHeaderView];
32 | if(previousHeaderView != nil){
33 | UIEdgeInsets contentInset = [self contentInset];
34 | UIEdgeInsets scrollInset = [self scrollIndicatorInsets];
35 | contentInset.top-=previousHeaderView.frame.size.height;
36 | scrollInset.top-=previousHeaderView.frame.size.height;
37 | [self setContentInset:contentInset];
38 | [self setScrollIndicatorInsets:scrollInset];
39 | [previousHeaderView removeFromSuperview];
40 | @try {
41 | [self removeObserver:self forKeyPath:@"contentOffset"];
42 | }
43 | @catch (NSException * __unused exception) {
44 |
45 | }
46 | previousHeaderView = nil;
47 |
48 | }
49 | }
50 | -(void)_handleNewHeaderView{
51 | if(self.floatingHeaderView!=nil){
52 | [self addSubview:self.floatingHeaderView];
53 | [self addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew context:IBFloatingHeaderViewContext];
54 | [self.floatingHeaderView setFrame:CGRectMake(0, -self.floatingHeaderView.frame.size.height, self.frame.size.width, self.floatingHeaderView.frame.size.height)];
55 | UIEdgeInsets contentInset = [self contentInset];
56 | UIEdgeInsets scrollInset = [self scrollIndicatorInsets];
57 | contentInset.top+=self.floatingHeaderView.frame.size.height;
58 | scrollInset.top+=self.floatingHeaderView.frame.size.height;
59 | [self setContentInset:contentInset];
60 | [self setScrollIndicatorInsets:scrollInset];
61 | [self setContentOffset:CGPointMake(0, -self.floatingHeaderView.frame.size.height)];
62 | }
63 | }
64 |
65 | #pragma mark - Scroll Logic
66 | /*
67 | * Three scrollStates:
68 | * - Fast Swipe up + header not visible = start showing the header
69 | * - Header is showing at least part of itself: scroll it by the content offset difference (with a maximum of the top offset)
70 | * - Header is completely showing = header should not scroll any more
71 | */
72 | -(void)_scrolledFromOffset:(CGFloat)oldYOffset toOffset:(CGFloat)newYOffset{
73 | CGPoint scrollVelocity = [[self panGestureRecognizer] velocityInView:self];
74 | BOOL fastSwipe = NO;
75 | if(abs(scrollVelocity.y)>1000){
76 | fastSwipe = YES;
77 | }
78 | BOOL isHeaderShowing = self.floatingHeaderView.frame.origin.y+self.floatingHeaderView.frame.size.height>=newYOffset;
79 | BOOL isHeaderCompletelyShowing = self.floatingHeaderView.frame.origin.y >= oldYOffset;
80 |
81 | if(fastSwipe && !isHeaderShowing && oldYOffset>newYOffset){
82 | CGFloat difference = oldYOffset-newYOffset;
83 | CGRect floatingFrame = self.floatingHeaderView.frame;
84 | floatingFrame.origin.y = newYOffset - floatingFrame.size.height + difference;
85 | if(floatingFrame.origin.y>newYOffset)
86 | floatingFrame.origin.y = newYOffset;
87 | [self.floatingHeaderView setFrame:floatingFrame];
88 | }
89 | if(isHeaderShowing){
90 | CGFloat difference = oldYOffset-newYOffset;
91 | CGRect floatingFrame = self.floatingHeaderView.frame;
92 | //floatingFrame.origin.y = floatingFrame.origin.y + difference;
93 | if(floatingFrame.origin.y>newYOffset)
94 | floatingFrame.origin.y = newYOffset;
95 | [self.floatingHeaderView setFrame:floatingFrame];
96 | }
97 | if(isHeaderCompletelyShowing && newYOffset<-self.floatingHeaderView.frame.size.height){
98 | CGRect floatingFrame = self.floatingHeaderView.frame;
99 | floatingFrame.origin.y = newYOffset;
100 | [self.floatingHeaderView setFrame:floatingFrame];
101 |
102 | }
103 | }
104 | #pragma mark - KVO
105 | - (void)observeValueForKeyPath:(NSString *)keyPath
106 | ofObject:(id)object
107 | change:(NSDictionary *)change
108 | context:(void *)context{
109 | if (context == IBFloatingHeaderViewContext) {
110 | if ([keyPath isEqualToString:@"contentOffset"]) {
111 | CGFloat oldYOffset = [[change objectForKey:@"old"]CGPointValue].y;
112 | CGFloat newYOffset = [[change objectForKey:@"new"]CGPointValue].y;
113 | [self _scrolledFromOffset:oldYOffset toOffset:newYOffset];
114 | }
115 | }else{
116 | [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
117 | }
118 | }
119 |
120 | - (void)removeContentOffsetObserver {
121 | [self removeObserver:self forKeyPath:@"contentOffset" context:IBFloatingHeaderViewContext];
122 | }
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader/IBScrollViewFloatingHeader/UIScrollView+IBFloatingHeader.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIScrollView+IBFloatingHeader.m
3 | // IBScrollViewFloatingHeader
4 | //
5 | // Created by Ivan Bruel on 04/01/14.
6 | // Copyright (c) 2014 Ivan Bruel. All rights reserved.
7 | //
8 |
9 | #import "UIScrollView+IBFloatingHeader.h"
10 | #import
11 |
12 | static void * IBFloatingHeaderViewKey = &IBFloatingHeaderViewKey;
13 | static void * IBFloatingHeaderViewContext = &IBFloatingHeaderViewContext;
14 |
15 | @implementation UIScrollView (IBFloatingHeader)
16 |
17 | #pragma mark - Setters/Getters
18 | -(UIView *)floatingHeaderView{
19 | return objc_getAssociatedObject(self, IBFloatingHeaderViewKey);
20 | }
21 |
22 | -(void)setFloatingHeaderView:(UIView *)headerView{
23 | [self _handlePreviousHeaderView];
24 |
25 | objc_setAssociatedObject(self, IBFloatingHeaderViewKey, headerView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
26 |
27 | [self _handleNewHeaderView];
28 | }
29 | #pragma mark - Handle add/remove of views;
30 | -(void)_handlePreviousHeaderView{
31 | UIView* previousHeaderView = [self floatingHeaderView];
32 | if(previousHeaderView != nil){
33 | UIEdgeInsets contentInset = [self contentInset];
34 | UIEdgeInsets scrollInset = [self scrollIndicatorInsets];
35 | contentInset.top-=previousHeaderView.frame.size.height;
36 | scrollInset.top-=previousHeaderView.frame.size.height;
37 | [self setContentInset:contentInset];
38 | [self setScrollIndicatorInsets:scrollInset];
39 | [previousHeaderView removeFromSuperview];
40 | @try {
41 | [self removeObserver:self forKeyPath:@"contentOffset"];
42 | }
43 | @catch (NSException * __unused exception) {
44 |
45 | }
46 | previousHeaderView = nil;
47 |
48 | }
49 | }
50 | -(void)_handleNewHeaderView{
51 | if(self.floatingHeaderView!=nil){
52 | [self addSubview:self.floatingHeaderView];
53 | [self addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew context:IBFloatingHeaderViewContext];
54 | [self.floatingHeaderView setFrame:CGRectMake(0, -self.floatingHeaderView.frame.size.height, self.frame.size.width, self.floatingHeaderView.frame.size.height)];
55 | UIEdgeInsets contentInset = [self contentInset];
56 | UIEdgeInsets scrollInset = [self scrollIndicatorInsets];
57 | contentInset.top+=self.floatingHeaderView.frame.size.height;
58 | scrollInset.top+=self.floatingHeaderView.frame.size.height;
59 | [self setContentInset:contentInset];
60 | [self setScrollIndicatorInsets:scrollInset];
61 | [self setContentOffset:CGPointMake(0, -self.floatingHeaderView.frame.size.height)];
62 | }
63 | }
64 |
65 | #pragma mark - Scroll Logic
66 | /*
67 | * Three scrollStates:
68 | * - Fast Swipe up + header not visible = start showing the header
69 | * - Header is showing at least part of itself: scroll it by the content offset difference (with a maximum of the top offset)
70 | * - Header is completely showing = header should not scroll any more
71 | */
72 | -(void)_scrolledFromOffset:(CGFloat)oldYOffset toOffset:(CGFloat)newYOffset{
73 | CGPoint scrollVelocity = [[self panGestureRecognizer] velocityInView:self];
74 | BOOL fastSwipe = NO;
75 | if(abs(scrollVelocity.y)>1000){
76 | fastSwipe = YES;
77 | }
78 | BOOL isHeaderShowing = self.floatingHeaderView.frame.origin.y+self.floatingHeaderView.frame.size.height>=newYOffset;
79 | BOOL isHeaderCompletelyShowing = self.floatingHeaderView.frame.origin.y >= oldYOffset;
80 |
81 | if(fastSwipe && !isHeaderShowing && oldYOffset>newYOffset){
82 | CGFloat difference = oldYOffset-newYOffset;
83 | CGRect floatingFrame = self.floatingHeaderView.frame;
84 | floatingFrame.origin.y = newYOffset - floatingFrame.size.height + difference;
85 | if(floatingFrame.origin.y>newYOffset)
86 | floatingFrame.origin.y = newYOffset;
87 | [self.floatingHeaderView setFrame:floatingFrame];
88 | }
89 | if(isHeaderShowing){
90 | CGFloat difference = oldYOffset-newYOffset;
91 | CGRect floatingFrame = self.floatingHeaderView.frame;
92 | //floatingFrame.origin.y = floatingFrame.origin.y + difference;
93 | if(floatingFrame.origin.y>newYOffset)
94 | floatingFrame.origin.y = newYOffset;
95 | [self.floatingHeaderView setFrame:floatingFrame];
96 | }
97 | if(isHeaderCompletelyShowing && newYOffset<-self.floatingHeaderView.frame.size.height){
98 | CGRect floatingFrame = self.floatingHeaderView.frame;
99 | floatingFrame.origin.y = newYOffset;
100 | [self.floatingHeaderView setFrame:floatingFrame];
101 |
102 | }
103 | }
104 | #pragma mark - KVO
105 | - (void)observeValueForKeyPath:(NSString *)keyPath
106 | ofObject:(id)object
107 | change:(NSDictionary *)change
108 | context:(void *)context{
109 | if (context == IBFloatingHeaderViewContext) {
110 | if ([keyPath isEqualToString:@"contentOffset"]) {
111 | CGFloat oldYOffset = [[change objectForKey:@"old"]CGPointValue].y;
112 | CGFloat newYOffset = [[change objectForKey:@"new"]CGPointValue].y;
113 | [self _scrolledFromOffset:oldYOffset toOffset:newYOffset];
114 | }
115 | }else{
116 | [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
117 | }
118 | }
119 |
120 | - (void)removeContentOffsetObserver {
121 | [self removeObserver:self forKeyPath:@"contentOffset" context:IBFloatingHeaderViewContext];
122 | }
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/Example/IBScrollViewFloatingHeader.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 30CF2FD21878918A003120B9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30CF2FD11878918A003120B9 /* Foundation.framework */; };
11 | 30CF2FD41878918A003120B9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30CF2FD31878918A003120B9 /* CoreGraphics.framework */; };
12 | 30CF2FD61878918A003120B9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30CF2FD51878918A003120B9 /* UIKit.framework */; };
13 | 30CF2FDC1878918A003120B9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30CF2FDA1878918A003120B9 /* InfoPlist.strings */; };
14 | 30CF2FDE1878918A003120B9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CF2FDD1878918A003120B9 /* main.m */; };
15 | 30CF2FE21878918A003120B9 /* IBAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CF2FE11878918A003120B9 /* IBAppDelegate.m */; };
16 | 30CF2FE51878918A003120B9 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 30CF2FE31878918A003120B9 /* Main_iPhone.storyboard */; };
17 | 30CF2FE81878918A003120B9 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 30CF2FE61878918A003120B9 /* Main_iPad.storyboard */; };
18 | 30CF2FEB1878918A003120B9 /* IBViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CF2FEA1878918A003120B9 /* IBViewController.m */; };
19 | 30CF2FED1878918A003120B9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 30CF2FEC1878918A003120B9 /* Images.xcassets */; };
20 | 30CF300C18789461003120B9 /* UIScrollView+IBFloatingHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CF300B18789461003120B9 /* UIScrollView+IBFloatingHeader.m */; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXFileReference section */
24 | 30CF2FCE1878918A003120B9 /* IBScrollViewFloatingHeader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IBScrollViewFloatingHeader.app; sourceTree = BUILT_PRODUCTS_DIR; };
25 | 30CF2FD11878918A003120B9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
26 | 30CF2FD31878918A003120B9 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
27 | 30CF2FD51878918A003120B9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
28 | 30CF2FD91878918A003120B9 /* IBScrollViewFloatingHeader-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "IBScrollViewFloatingHeader-Info.plist"; sourceTree = ""; };
29 | 30CF2FDB1878918A003120B9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
30 | 30CF2FDD1878918A003120B9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
31 | 30CF2FDF1878918A003120B9 /* IBScrollViewFloatingHeader-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "IBScrollViewFloatingHeader-Prefix.pch"; sourceTree = ""; };
32 | 30CF2FE01878918A003120B9 /* IBAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IBAppDelegate.h; sourceTree = ""; };
33 | 30CF2FE11878918A003120B9 /* IBAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IBAppDelegate.m; sourceTree = ""; };
34 | 30CF2FE41878918A003120B9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; };
35 | 30CF2FE71878918A003120B9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; };
36 | 30CF2FE91878918A003120B9 /* IBViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IBViewController.h; sourceTree = ""; };
37 | 30CF2FEA1878918A003120B9 /* IBViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IBViewController.m; sourceTree = ""; };
38 | 30CF2FEC1878918A003120B9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
39 | 30CF2FF31878918A003120B9 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
40 | 30CF2FFB1878918A003120B9 /* IBScrollViewFloatingHeaderTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "IBScrollViewFloatingHeaderTests-Info.plist"; sourceTree = ""; };
41 | 30CF2FFD1878918A003120B9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
42 | 30CF2FFF1878918A003120B9 /* IBScrollViewFloatingHeaderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IBScrollViewFloatingHeaderTests.m; sourceTree = ""; };
43 | 30CF300A18789461003120B9 /* UIScrollView+IBFloatingHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIScrollView+IBFloatingHeader.h"; path = "IBScrollViewFloatingHeader/UIScrollView+IBFloatingHeader.h"; sourceTree = ""; };
44 | 30CF300B18789461003120B9 /* UIScrollView+IBFloatingHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIScrollView+IBFloatingHeader.m"; path = "IBScrollViewFloatingHeader/UIScrollView+IBFloatingHeader.m"; sourceTree = ""; };
45 | /* End PBXFileReference section */
46 |
47 | /* Begin PBXFrameworksBuildPhase section */
48 | 30CF2FCB1878918A003120B9 /* Frameworks */ = {
49 | isa = PBXFrameworksBuildPhase;
50 | buildActionMask = 2147483647;
51 | files = (
52 | 30CF2FD41878918A003120B9 /* CoreGraphics.framework in Frameworks */,
53 | 30CF2FD61878918A003120B9 /* UIKit.framework in Frameworks */,
54 | 30CF2FD21878918A003120B9 /* Foundation.framework in Frameworks */,
55 | );
56 | runOnlyForDeploymentPostprocessing = 0;
57 | };
58 | /* End PBXFrameworksBuildPhase section */
59 |
60 | /* Begin PBXGroup section */
61 | 30CF2FC51878918A003120B9 = {
62 | isa = PBXGroup;
63 | children = (
64 | 30CF2FD71878918A003120B9 /* IBScrollViewFloatingHeader */,
65 | 30CF2FF91878918A003120B9 /* IBScrollViewFloatingHeaderTests */,
66 | 30CF2FD01878918A003120B9 /* Frameworks */,
67 | 30CF2FCF1878918A003120B9 /* Products */,
68 | );
69 | sourceTree = "";
70 | };
71 | 30CF2FCF1878918A003120B9 /* Products */ = {
72 | isa = PBXGroup;
73 | children = (
74 | 30CF2FCE1878918A003120B9 /* IBScrollViewFloatingHeader.app */,
75 | );
76 | name = Products;
77 | sourceTree = "";
78 | };
79 | 30CF2FD01878918A003120B9 /* Frameworks */ = {
80 | isa = PBXGroup;
81 | children = (
82 | 30CF2FD11878918A003120B9 /* Foundation.framework */,
83 | 30CF2FD31878918A003120B9 /* CoreGraphics.framework */,
84 | 30CF2FD51878918A003120B9 /* UIKit.framework */,
85 | 30CF2FF31878918A003120B9 /* XCTest.framework */,
86 | );
87 | name = Frameworks;
88 | sourceTree = "";
89 | };
90 | 30CF2FD71878918A003120B9 /* IBScrollViewFloatingHeader */ = {
91 | isa = PBXGroup;
92 | children = (
93 | 30CF30091878942E003120B9 /* IBScrollViewFloatingHeader */,
94 | 30CF2FE01878918A003120B9 /* IBAppDelegate.h */,
95 | 30CF2FE11878918A003120B9 /* IBAppDelegate.m */,
96 | 30CF2FE31878918A003120B9 /* Main_iPhone.storyboard */,
97 | 30CF2FE61878918A003120B9 /* Main_iPad.storyboard */,
98 | 30CF2FE91878918A003120B9 /* IBViewController.h */,
99 | 30CF2FEA1878918A003120B9 /* IBViewController.m */,
100 | 30CF2FEC1878918A003120B9 /* Images.xcassets */,
101 | 30CF2FD81878918A003120B9 /* Supporting Files */,
102 | );
103 | path = IBScrollViewFloatingHeader;
104 | sourceTree = "";
105 | };
106 | 30CF2FD81878918A003120B9 /* Supporting Files */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 30CF2FD91878918A003120B9 /* IBScrollViewFloatingHeader-Info.plist */,
110 | 30CF2FDA1878918A003120B9 /* InfoPlist.strings */,
111 | 30CF2FDD1878918A003120B9 /* main.m */,
112 | 30CF2FDF1878918A003120B9 /* IBScrollViewFloatingHeader-Prefix.pch */,
113 | );
114 | name = "Supporting Files";
115 | sourceTree = "";
116 | };
117 | 30CF2FF91878918A003120B9 /* IBScrollViewFloatingHeaderTests */ = {
118 | isa = PBXGroup;
119 | children = (
120 | 30CF2FFF1878918A003120B9 /* IBScrollViewFloatingHeaderTests.m */,
121 | 30CF2FFA1878918A003120B9 /* Supporting Files */,
122 | );
123 | path = IBScrollViewFloatingHeaderTests;
124 | sourceTree = "";
125 | };
126 | 30CF2FFA1878918A003120B9 /* Supporting Files */ = {
127 | isa = PBXGroup;
128 | children = (
129 | 30CF2FFB1878918A003120B9 /* IBScrollViewFloatingHeaderTests-Info.plist */,
130 | 30CF2FFC1878918A003120B9 /* InfoPlist.strings */,
131 | );
132 | name = "Supporting Files";
133 | sourceTree = "";
134 | };
135 | 30CF30091878942E003120B9 /* IBScrollViewFloatingHeader */ = {
136 | isa = PBXGroup;
137 | children = (
138 | 30CF300A18789461003120B9 /* UIScrollView+IBFloatingHeader.h */,
139 | 30CF300B18789461003120B9 /* UIScrollView+IBFloatingHeader.m */,
140 | );
141 | name = IBScrollViewFloatingHeader;
142 | sourceTree = "";
143 | };
144 | /* End PBXGroup section */
145 |
146 | /* Begin PBXNativeTarget section */
147 | 30CF2FCD1878918A003120B9 /* IBScrollViewFloatingHeader */ = {
148 | isa = PBXNativeTarget;
149 | buildConfigurationList = 30CF30031878918A003120B9 /* Build configuration list for PBXNativeTarget "IBScrollViewFloatingHeader" */;
150 | buildPhases = (
151 | 30CF2FCA1878918A003120B9 /* Sources */,
152 | 30CF2FCB1878918A003120B9 /* Frameworks */,
153 | 30CF2FCC1878918A003120B9 /* Resources */,
154 | );
155 | buildRules = (
156 | );
157 | dependencies = (
158 | );
159 | name = IBScrollViewFloatingHeader;
160 | productName = IBScrollViewFloatingHeader;
161 | productReference = 30CF2FCE1878918A003120B9 /* IBScrollViewFloatingHeader.app */;
162 | productType = "com.apple.product-type.application";
163 | };
164 | /* End PBXNativeTarget section */
165 |
166 | /* Begin PBXProject section */
167 | 30CF2FC61878918A003120B9 /* Project object */ = {
168 | isa = PBXProject;
169 | attributes = {
170 | CLASSPREFIX = IB;
171 | LastUpgradeCheck = 0500;
172 | ORGANIZATIONNAME = "Ivan Bruel";
173 | };
174 | buildConfigurationList = 30CF2FC91878918A003120B9 /* Build configuration list for PBXProject "IBScrollViewFloatingHeader" */;
175 | compatibilityVersion = "Xcode 3.2";
176 | developmentRegion = English;
177 | hasScannedForEncodings = 0;
178 | knownRegions = (
179 | en,
180 | Base,
181 | );
182 | mainGroup = 30CF2FC51878918A003120B9;
183 | productRefGroup = 30CF2FCF1878918A003120B9 /* Products */;
184 | projectDirPath = "";
185 | projectRoot = "";
186 | targets = (
187 | 30CF2FCD1878918A003120B9 /* IBScrollViewFloatingHeader */,
188 | );
189 | };
190 | /* End PBXProject section */
191 |
192 | /* Begin PBXResourcesBuildPhase section */
193 | 30CF2FCC1878918A003120B9 /* Resources */ = {
194 | isa = PBXResourcesBuildPhase;
195 | buildActionMask = 2147483647;
196 | files = (
197 | 30CF2FE81878918A003120B9 /* Main_iPad.storyboard in Resources */,
198 | 30CF2FED1878918A003120B9 /* Images.xcassets in Resources */,
199 | 30CF2FE51878918A003120B9 /* Main_iPhone.storyboard in Resources */,
200 | 30CF2FDC1878918A003120B9 /* InfoPlist.strings in Resources */,
201 | );
202 | runOnlyForDeploymentPostprocessing = 0;
203 | };
204 | /* End PBXResourcesBuildPhase section */
205 |
206 | /* Begin PBXSourcesBuildPhase section */
207 | 30CF2FCA1878918A003120B9 /* Sources */ = {
208 | isa = PBXSourcesBuildPhase;
209 | buildActionMask = 2147483647;
210 | files = (
211 | 30CF2FDE1878918A003120B9 /* main.m in Sources */,
212 | 30CF300C18789461003120B9 /* UIScrollView+IBFloatingHeader.m in Sources */,
213 | 30CF2FE21878918A003120B9 /* IBAppDelegate.m in Sources */,
214 | 30CF2FEB1878918A003120B9 /* IBViewController.m in Sources */,
215 | );
216 | runOnlyForDeploymentPostprocessing = 0;
217 | };
218 | /* End PBXSourcesBuildPhase section */
219 |
220 | /* Begin PBXVariantGroup section */
221 | 30CF2FDA1878918A003120B9 /* InfoPlist.strings */ = {
222 | isa = PBXVariantGroup;
223 | children = (
224 | 30CF2FDB1878918A003120B9 /* en */,
225 | );
226 | name = InfoPlist.strings;
227 | sourceTree = "";
228 | };
229 | 30CF2FE31878918A003120B9 /* Main_iPhone.storyboard */ = {
230 | isa = PBXVariantGroup;
231 | children = (
232 | 30CF2FE41878918A003120B9 /* Base */,
233 | );
234 | name = Main_iPhone.storyboard;
235 | sourceTree = "";
236 | };
237 | 30CF2FE61878918A003120B9 /* Main_iPad.storyboard */ = {
238 | isa = PBXVariantGroup;
239 | children = (
240 | 30CF2FE71878918A003120B9 /* Base */,
241 | );
242 | name = Main_iPad.storyboard;
243 | sourceTree = "";
244 | };
245 | 30CF2FFC1878918A003120B9 /* InfoPlist.strings */ = {
246 | isa = PBXVariantGroup;
247 | children = (
248 | 30CF2FFD1878918A003120B9 /* en */,
249 | );
250 | name = InfoPlist.strings;
251 | sourceTree = "";
252 | };
253 | /* End PBXVariantGroup section */
254 |
255 | /* Begin XCBuildConfiguration section */
256 | 30CF30011878918A003120B9 /* Debug */ = {
257 | isa = XCBuildConfiguration;
258 | buildSettings = {
259 | ALWAYS_SEARCH_USER_PATHS = NO;
260 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
261 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
262 | CLANG_CXX_LIBRARY = "libc++";
263 | CLANG_ENABLE_MODULES = YES;
264 | CLANG_ENABLE_OBJC_ARC = YES;
265 | CLANG_WARN_BOOL_CONVERSION = YES;
266 | CLANG_WARN_CONSTANT_CONVERSION = YES;
267 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
268 | CLANG_WARN_EMPTY_BODY = YES;
269 | CLANG_WARN_ENUM_CONVERSION = YES;
270 | CLANG_WARN_INT_CONVERSION = YES;
271 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
273 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
274 | COPY_PHASE_STRIP = NO;
275 | GCC_C_LANGUAGE_STANDARD = gnu99;
276 | GCC_DYNAMIC_NO_PIC = NO;
277 | GCC_OPTIMIZATION_LEVEL = 0;
278 | GCC_PREPROCESSOR_DEFINITIONS = (
279 | "DEBUG=1",
280 | "$(inherited)",
281 | );
282 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
283 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
284 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
285 | GCC_WARN_UNDECLARED_SELECTOR = YES;
286 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
287 | GCC_WARN_UNUSED_FUNCTION = YES;
288 | GCC_WARN_UNUSED_VARIABLE = YES;
289 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
290 | ONLY_ACTIVE_ARCH = YES;
291 | SDKROOT = iphoneos;
292 | TARGETED_DEVICE_FAMILY = "1,2";
293 | };
294 | name = Debug;
295 | };
296 | 30CF30021878918A003120B9 /* Release */ = {
297 | isa = XCBuildConfiguration;
298 | buildSettings = {
299 | ALWAYS_SEARCH_USER_PATHS = NO;
300 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
302 | CLANG_CXX_LIBRARY = "libc++";
303 | CLANG_ENABLE_MODULES = YES;
304 | CLANG_ENABLE_OBJC_ARC = YES;
305 | CLANG_WARN_BOOL_CONVERSION = YES;
306 | CLANG_WARN_CONSTANT_CONVERSION = YES;
307 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
308 | CLANG_WARN_EMPTY_BODY = YES;
309 | CLANG_WARN_ENUM_CONVERSION = YES;
310 | CLANG_WARN_INT_CONVERSION = YES;
311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
313 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
314 | COPY_PHASE_STRIP = YES;
315 | ENABLE_NS_ASSERTIONS = NO;
316 | GCC_C_LANGUAGE_STANDARD = gnu99;
317 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
318 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
319 | GCC_WARN_UNDECLARED_SELECTOR = YES;
320 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
321 | GCC_WARN_UNUSED_FUNCTION = YES;
322 | GCC_WARN_UNUSED_VARIABLE = YES;
323 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
324 | SDKROOT = iphoneos;
325 | TARGETED_DEVICE_FAMILY = "1,2";
326 | VALIDATE_PRODUCT = YES;
327 | };
328 | name = Release;
329 | };
330 | 30CF30041878918A003120B9 /* Debug */ = {
331 | isa = XCBuildConfiguration;
332 | buildSettings = {
333 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
334 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
335 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
336 | GCC_PREFIX_HEADER = "IBScrollViewFloatingHeader/IBScrollViewFloatingHeader-Prefix.pch";
337 | INFOPLIST_FILE = "IBScrollViewFloatingHeader/IBScrollViewFloatingHeader-Info.plist";
338 | PRODUCT_NAME = "$(TARGET_NAME)";
339 | WRAPPER_EXTENSION = app;
340 | };
341 | name = Debug;
342 | };
343 | 30CF30051878918A003120B9 /* Release */ = {
344 | isa = XCBuildConfiguration;
345 | buildSettings = {
346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
347 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
348 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
349 | GCC_PREFIX_HEADER = "IBScrollViewFloatingHeader/IBScrollViewFloatingHeader-Prefix.pch";
350 | INFOPLIST_FILE = "IBScrollViewFloatingHeader/IBScrollViewFloatingHeader-Info.plist";
351 | PRODUCT_NAME = "$(TARGET_NAME)";
352 | WRAPPER_EXTENSION = app;
353 | };
354 | name = Release;
355 | };
356 | /* End XCBuildConfiguration section */
357 |
358 | /* Begin XCConfigurationList section */
359 | 30CF2FC91878918A003120B9 /* Build configuration list for PBXProject "IBScrollViewFloatingHeader" */ = {
360 | isa = XCConfigurationList;
361 | buildConfigurations = (
362 | 30CF30011878918A003120B9 /* Debug */,
363 | 30CF30021878918A003120B9 /* Release */,
364 | );
365 | defaultConfigurationIsVisible = 0;
366 | defaultConfigurationName = Release;
367 | };
368 | 30CF30031878918A003120B9 /* Build configuration list for PBXNativeTarget "IBScrollViewFloatingHeader" */ = {
369 | isa = XCConfigurationList;
370 | buildConfigurations = (
371 | 30CF30041878918A003120B9 /* Debug */,
372 | 30CF30051878918A003120B9 /* Release */,
373 | );
374 | defaultConfigurationIsVisible = 0;
375 | };
376 | /* End XCConfigurationList section */
377 | };
378 | rootObject = 30CF2FC61878918A003120B9 /* Project object */;
379 | }
380 |
--------------------------------------------------------------------------------