Giter Site home page Giter Site logo

parallaxtableviewheader's Introduction

ParallaxTableViewHeader

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

solarized vim solarized vim solarized vim

Usage

Create a ParallaxHeaderView using either of one API's

  • (id)parallaxHeaderViewWithImage:(UIImage *)image forSize:(CGSize)headerSize
  • (id)parallaxHeaderViewWithCGSize:(CGSize)headerSize

set the parallaxHeaderView to UITableViewHeader as shown below solarized vim

override scrollViewDelegate method

  • (void)scrollViewDidScroll:(UIScrollView *)scrollView

Pass the UITableView or UIScrollView scrolling contentOffset to ParallaxHeaderView as shown below. solarized vim

"thats it"

Swift

let headerView: ParallaxHeaderView = ParallaxHeaderView.parallaxHeaderViewWithImage(UIImage(named: "YourImageName"), forSize: CGSizeMake(self.tableview.frame.size.height, 300)) as ParallaxHeaderView
self.tableview.tableHeaderView = headerView

func  scrollViewDidScroll(scrollView: UIScrollView) {
    let header: ParallaxHeaderView = self.tableview.tableHeaderView as ParallaxHeaderView
    header.layoutHeaderViewForScrollViewOffset(scrollView.contentOffset)

    self.tableview.tableHeaderView = header
}

Credits

Used UIImage+ImageEffects (Extentions) of Created by Aaron Pang, achiving Bluring effect to headerView, support from iOS 7.0 onwords

parallaxtableviewheader's People

Contributors

lfarah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parallaxtableviewheader's Issues

Image and label not centered + blur turns black

Hi,

thanks for the great parallax effect, however I am having issues with it. Namely the image and label appear too far to the right until I scroll, when they are replaced correcly.

Also, the blur turns the image completely dark rather than simply blurring it.

I am using xcode 7 and swift 2.0

How to add Gesture Recognizer to headerView?

I tried adding gestureRecognizer directly to headerView but not working, so I also tried:

` let headerImageView = UIImageView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.width*0.667))

    headerImageView.image = headerImage

    headerImageView.userInteractionEnabled = true

    let tap = UIGestureRecognizer(target: self, action: "showOrgIntroView")

    headerImageView.addGestureRecognizer(tap)

    let headerView = ParallaxHeaderView.parallaxHeaderViewWithSubView(headerImageView) as! ParallaxHeaderView

    self.tableView.tableHeaderView = headerView`

But it still doesn't work either.

observe tableview contentoffset

This header needs to be layout on tableview delegate, why not just add observer for the contentOffset for the tableView inside this header?

pod

can you plz make it pod

cocoapods

I loved your library, if you intersete, I can help with cocoapods adiction.

there is a bug with parallaxHeaderViewWithSubView:

hi, thanks for your code
i attempt to use this method to creat a headerView. my subView has a button for login. when i clicked login button to push to loginViewController and back to root, the bluredImageView is malposition.

finally,i fix this bug by following code:

  • (void)refreshBlurViewForNewImage
    {
    UIImage *screenShot;
    if (self.subView) {
    screenShot = [self getImageFromView:self.subView];
    }else{
    screenShot = [self getImageFromView:self];
    }
    screenShot = [screenShot applyBlurWithRadius:5 tintColor:[UIColor colorWithWhite:0.6 alpha:0.2] saturationDeltaFactor:1.0 maskImage:nil];
    self.bluredImageView.image = screenShot;
    self.bluredImageView.alpha = 0.0f;
    }

and , i find the screenShot method in the code always flicker when it is called, so i instead of method :
-(UIImage *)getImageFromView:(UIView *)orgView{
UIGraphicsBeginImageContext(orgView.bounds.size);
[orgView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Forgive my rude,may it's my own mistack, thancks a lot.

Typo in Swift sample code

The swift sample code does not setup the view properly. It should be using the width not the height of the tableview.
let headerView: ParallaxHeaderView = ParallaxHeaderView.parallaxHeaderViewWithImage(UIImage(named: "YourImageName"), forSize: CGSizeMake(self.tableview.frame.size.width, 300)) as ParallaxHeaderView

Page Control

Is there is any way to include the page control to the parallax effect.

Swift 2

Is it compatible with swift 2?

I am trying to implement this with Xcode7 and swift 2.

will it be possible to do from storyboard?

is there any example for it?

Thanks in advance.. :)

Take time to load the view

Hi, nice plugin.
I have one issue. I have navigation controller. My root view controller is FirstView and SecondView contains tableview with parallaxTableViewHeader. Now when i push from FirstView to SecondView it will take time to push to SecondView. (parallaxtableviewheader setup takes time to load the second view)
Can anyone give the suggestion to resolve this issue.

Thanks.

Extreme scrolling causes blur effect bug

Hey,

What a brilliant parallax effect! Excellent job. I was only wondering if there was a way to fix this error:

What it is:
screen shot 2015-10-18 at 09 44 22

What it should be:
screen shot 2015-10-18 at 09 44 33

This occurs in the following circumstances:

  1. Scroll up to cover the header and reveal bottom cells
  2. Scroll very vigorously in one movement down again to reveal the header
  3. No side expansion with bounce or anything happens, it just increases in height and stays blurred.

A thing I have noticed is that the less the kParallaxDeltaFactor, the less the bug. I have it set a 1.0f. (The nav bar has nothing to do with it).

Any help would be greatly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.