All Projects → romansorochak → Parallaxheader

romansorochak / Parallaxheader

Licence: mit
Simple way to add parallax header to UIScrollView/UITableView written in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Parallaxheader

Containercontroller
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273 (-66.21%)
Mutual labels:  xcode, cocoapods, tableview, scrollview
Mylinearlayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITab…
Stars: ✭ 4,152 (+413.86%)
Mutual labels:  xcode, cocoapods, uiscrollview
Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-84.53%)
Mutual labels:  xcode, cocoapods, tableview
Accordionswift
The best way of implement an accordion menu using an UITableView in Swift
Stars: ✭ 156 (-80.69%)
Mutual labels:  xcode, cocoapods, tableview
Ttsegmentedcontrol
An elegant, animated and customizable segmented control for iOS created by Tapptitude
Stars: ✭ 471 (-41.71%)
Mutual labels:  xcode, cocoapods
Gedatsu
Gedatsu provide readable format about AutoLayout error console log
Stars: ✭ 464 (-42.57%)
Mutual labels:  xcode, cocoapods
Jt3dscrollview
ScrollView with custom effects during the scroll for iOS
Stars: ✭ 494 (-38.86%)
Mutual labels:  scrollview, uiscrollview
Xcake
🍰 Describe Xcode projects in a human readable format and (re)generate one on demand.
Stars: ✭ 549 (-32.05%)
Mutual labels:  xcode, cocoapods
Progresskit
Progress Views for Cocoa
Stars: ✭ 510 (-36.88%)
Mutual labels:  xcode, cocoapods
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (-29.46%)
Mutual labels:  xcode, cocoapods
Hvscrollview
这不是框架,只是3个示例程序,给大家提供一个实现这种布局的思路
Stars: ✭ 584 (-27.72%)
Mutual labels:  tableview, scrollview
Font Awesome Swift
Font Awesome swift library for iOS.
Stars: ✭ 743 (-8.04%)
Mutual labels:  xcode, cocoapods
Dnspageview
一个纯 Swift 的轻量级、灵活且易于使用的 pageView
Stars: ✭ 461 (-42.95%)
Mutual labels:  xcode, cocoapods
Xcodebenchmark
XcodeBenchmark measures the compilation time of a large codebase on iMac, MacBook, and Mac Pro
Stars: ✭ 736 (-8.91%)
Mutual labels:  xcode, cocoapods
Uitextfield Navigation
🏄‍♂️ UITextField-Navigation makes it easier to navigate between UITextFields and UITextViews
Stars: ✭ 436 (-46.04%)
Mutual labels:  xcode, cocoapods
Listplaceholder
ListPlaceholder is a swift library allows you to easily add facebook style animated loading placeholder to your tableviews or collection views.
Stars: ✭ 511 (-36.76%)
Mutual labels:  cocoapods, tableview
Monkeydev
CaptainHook Tweak、Logos Tweak and Command-line Tool、Patch iOS Apps, Without Jailbreak.
Stars: ✭ 5,492 (+579.7%)
Mutual labels:  xcode, cocoapods
Badgehub
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.
Stars: ✭ 592 (-26.73%)
Mutual labels:  xcode, cocoapods
Txscrolllabelview
🌭TXScrollLabelView, the best way to show & display information such as adverts / boardcast / onsale e.g. with a customView.
Stars: ✭ 714 (-11.63%)
Mutual labels:  cocoapods, scrollview
Jyradarchart
an iOS open source Radar Chart implementation
Stars: ✭ 419 (-48.14%)
Mutual labels:  xcode, cocoapods

ParallaxHeader

Simple way to add parallax header to UIScrollView or it's subclasses.

One image view Slider with images Blur vibrant text Blur round icon
Demo Demo Demo Demo

Try it here

Contents

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build Reusable 1.0.0+.

To integrate ParallaxHeader into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'ParallaxHeader', '~> 3.0.0'
end

Then, run the following command:

$ pod install

Cocoapods versions

  • Swift5 :
pod 'ParallaxHeader', '~> 3.0.0'
  • Swift4 :
pod 'ParallaxHeader', '~> 2.0.0'
  • Swift3 :
pod 'ParallaxHeader', '~> 1.0.6'

Usage

To add parallax header to scroll view (table view) you need just create view and set it to your scroll view (table view).

Use case - one image view

  //create view as header view    
  let imageView = UIImageView()
  imageView.image = UIImage(named: "1")
  imageView.contentMode = .scaleAspectFill
        
  tableView.parallaxHeader.view = imageView
  tableView.parallaxHeader.height = 400
  tableView.parallaxHeader.minimumHeight = 0
  tableView.parallaxHeader.mode = .topFill

Use case - slider of images

let parallaxHeight: CGFloat = view.frame.height - 64 - 49 - sliderHeight
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
collectionParallaxView = UICollectionView(
    frame: CGRect(x: 0, y: 0, width: view.frame.width, height: parallaxHeight),
    collectionViewLayout: layout
)
collectionParallaxView.isPagingEnabled = true
collectionParallaxView.showsHorizontalScrollIndicator = false
collectionParallaxView.backgroundColor = UIColor.white
collectionParallaxView.delegate = self
collectionParallaxView.dataSource = self

//adding view as parallax header to table view is straightforward
tableView.parallaxHeader.view = collectionParallaxView
tableView.parallaxHeader.height = parallaxHeight
tableView.parallaxHeader.minimumHeight = 0
tableView.parallaxHeader.mode = .centerFill
tableView.parallaxHeader.parallaxHeaderDidScrollHandler = { parallaxHeader in
    print(parallaxHeader.progress)
}

Use case - Blur vibrant text

  • Blur library is used here.
  • SnapKit library is used here.
let imageView = UIImageView()
imageView.image = UIImage(named: "profile")
imageView.contentMode = .scaleAspectFill
        
//setup blur vibrant view
imageView.blurView.setup(style: UIBlurEffectStyle.dark, alpha: 1).enable()
        
headerImageView = imageView
        
tableView.parallaxHeader.view = imageView
tableView.parallaxHeader.height = 400
tableView.parallaxHeader.minimumHeight = 40
tableView.parallaxHeader.mode = .centerFill
tableView.parallaxHeader.parallaxHeaderDidScrollHandler = { parallaxHeader in
    //update alpha of blur view on top of image view 
    parallaxHeader.view.blurView.alpha = 1 - parallaxHeader.progress
}
        
// Label for vibrant text
let vibrantLabel = UILabel()
vibrantLabel.text = "Vibrant"
vibrantLabel.font = UIFont.systemFont(ofSize: 40.0)
vibrantLabel.sizeToFit()
vibrantLabel.textAlignment = .center
imageView.blurView.vibrancyContentView?.addSubview(vibrantLabel)
//add constraints using SnapKit library
vibrantLabel.snp.makeConstraints { make in
    make.edges.equalToSuperview()
}

Use case - Blur round icon

  • Blur library is used here.
  • SnapKit library is used here.
let image = UIImage(named: "profile")
        
let imageView = UIImageView()
imageView.image = image
imageView.contentMode = .scaleAspectFill
parallaxHeaderView = imageView
        
//setup bur view
imageView.blurView.setup(style: UIBlurEffectStyle.dark, alpha: 1).enable()
        
tableView.parallaxHeader.view = imageView
tableView.parallaxHeader.height = 400
tableView.parallaxHeader.minimumHeight = 120
tableView.parallaxHeader.mode = .centerFill
tableView.parallaxHeader.parallaxHeaderDidScrollHandler = { parallaxHeader in
    //update alpha of blur view on top of image view
    parallaxHeader.view.blurView.alpha = 1 - parallaxHeader.progress
}
        
let roundIcon = UIImageView(
    frame: CGRect(x: 0, y: 0, width: 100, height: 100)
)
roundIcon.image = image
roundIcon.layer.borderColor = UIColor.white.cgColor
roundIcon.layer.borderWidth = 2
roundIcon.layer.cornerRadius = roundIcon.frame.width / 2
roundIcon.clipsToBounds = true
        
//add round image view to blur content view
//do not use vibrancyContentView to prevent vibrant effect
imageView.blurView.blurContentView?.addSubview(roundIcon)
//add constraints using SnpaKit library
roundIcon.snp.makeConstraints { make in
    make.center.equalToSuperview()
    make.width.height.equalTo(100)
}

Author

Roman Sorochak - iOS developer - [email protected]

License

ParallaxHeader is released under the MIT license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].