Home

Awesome

THIS IS DISCONTINUED, SEE THIS FOLLOWUP PROJECT

M6UniversalParallaxViewController https://github.com/peterpaulis/M6UniversalParallaxViewController

M6ParallaxController

Parallax controller for a parallaxed view and a table view

Version 1.1

##Usage (Without storyboards)

##Storyboard Usage

#import <UIKit/UIKit.h>
#import "M6ParallaxController.h"
            
@interface MyParallaxController : M6ParallaxController
            
@end
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    
    [self.parallaxController tableViewControllerDidScroll:self];
    
}
-(void) awakeFromNib
{
    UIViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:@"ParallaxedViewController"];
    UITableViewController * tvc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyTableViewController"];
    
    [self setupWithTopViewController:vc height:100 tableViewController:tvc];
}

##Special effects

- (void)willChangeHeightOfTopViewControllerFromHeight:(CGFloat)oldHeight toHeight:(CGFloat)newHeight;

##Tapping the top parallaxed controller

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

and test for a specific area

#Tapping buttons in the top parallaxed controller

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    
    CGPoint tapPoint = [touch locationInView:self.view];;
    
    if (([self.topViewController.view hitTest:tapPoint withEvent:nil])) {
    
        MyTopViewController * mtvc = (MyTopViewController *)self.topViewController;
        
        // check for tap into button 1
        tapPoint = [touch locationInView:mtvc.button1];
        if ([mtvc.button1 hitTest:tapPoint withEvent:nil]) {
            [mtvc.button1 sendActionsForControlEvents:UIControlEventTouchUpInside];
            return YES;
        }
        
        ...
    }
    
    return NO;
}

##Table view sections

##License Apache License 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt

##Issues There may be an issue with using a navigation controller in that case use the following code. The problem is, that the frame changes, and is not final in viewDidLoad

- (void)viewDidAppear:(BOOL)animated {
    
    [super viewDidAppear:animated];
    
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        // setup
        {
            UIViewController * topViewController = [TopDesireViewController new];
            UITableViewController * tableViewController = [DesiresListingViewController new];
            
            [self setupWithTopViewController:topViewController height:230.f tableViewController:tableViewController];
            
        }
    });
    
}

##Credits min:60 - Building perfect mobile apps, for affordable price - <a href="http://min60.com">http://min60.com</a>