SkillAgentSearch skills...

TCParallax

Parallax scrolling effect on UITableView header view when a tableView is scrolled

Install / Use

/learn @itanchao/TCParallax
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

TCParallax

写在前面:

Parallax scrolling effect on UITableView header view when a tableView is scrolled

使用

platform :ios, ‘8.0’ 
use_frameworks!
target "TCParallaxExample" do
	pod 'TCParallax'
end

API

 ///  创建一个只有一张图片的headerView
 ///
 ///  - parameter image:     要展示的图片
 ///  - parameter forSize:   view大xiao
 ///  - parameter referView: 依赖view(headerView会依赖于这个view形变)
static func creatParallaxScrollViewWithImage(image:UIImage,forSize:CGSize,referView:UIScrollView?) -> ParallaxScrollView 

 ///  将一个view改造成ParallaxView
 ///
 ///  - parameter subView:   view
 ///  - parameter referView: 依赖view(headerView会依赖于这个view形变)
static func creatParallaxScrollViewWithSubView(subView:UIView,referView:UIScrollView) -> ParallaxScrollView 

使用

Swift

let headerView = ParallaxScrollView.creatParallaxScrollViewWithImage(UIImage(named: "imageDemo.jpg")!, forSize: CGSize(width: tableView.bounds.width, height: 300),referView: tableView) 
tableView.tableHeaderView = headerView

Object-C

- (UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
        _tableView.tableHeaderView = [ParallaxScrollView creatParallaxScrollViewWithSubView:self.headerView referView:_tableView];
        _tableView.backgroundColor = [UIColor whiteColor];
        _tableView.rowHeight = 45;
        _tableView.delegate = self;
        _tableView.dataSource = self;
    }
    return _tableView;
}
- (EditeUserHeaderView *)headerView{
    if (!_headerView) {
        _headerView = [[EditeUserHeaderView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 167)];
        _headerView.backgroundColor = Color(@"#040406");
        _headerView.delegate = self;
         _headerView.user = self.user;
    }
    return _headerView;
}

solarized vim

Related Skills

View on GitHub
GitHub Stars10
CategoryDevelopment
Updated1y ago
Forks1

Languages

Swift

Security Score

75/100

Audited on Mar 11, 2025

No findings