Skip to content

Latest commit

 

History

History
60 lines (35 loc) · 1.49 KB

README.md

File metadata and controls

60 lines (35 loc) · 1.49 KB

CSInteractiveHeaders

A dead simple implementation of interactive (stretchable) header images that can easily be added to any UIScrollView, UITableView, UICollectionView, etc. This includes a navigation category to interactivly control the navigation bar transparency with the scroll view.

demo

Implementation

Implementing Interactive Headers

Import the category:

#import "UIScrollView+InteractiveHeader.h"

In your ViewController:

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.extendedLayoutIncludesOpaqueBars = YES;
    [self.tableView addHeaderWithImage:[UIImage imageNamed:@"banner.jpg"] height:300];
    [self.tableView.interactiveHeader setUseAlphaFade:YES];
    [self.tableView.interactiveHeader setLabelOffset:22];
    [self.tableView.interactiveHeader.titleLabel setText:@"A Clever Title"];
    [self.tableView.interactiveHeader.subtitleLabel setText:@"Some Sub-text"];
}

Implementing Interactive Navigation Bars

Import the category:

#import "UINavigationBar+InteractiveHeader.h"

In your ViewController:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [self.navigationController.navigationBar setScrollView:self.tableView];
    [self.navigationController.navigationBar setScrollTintColor:UIColor.darkTextColor];
}

thats it, your done.

Author

Dana Buehre (CreatureSurvive) [email protected]

© Dana Buehre (CreatureSurvive) 2020