Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhenry committed Aug 3, 2014
2 parents 3a4365c + 2db04d0 commit 7096ef4
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Classes/MHYahooParallaxCollectionViewLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Michael Henry Pantaleon on 18/07/2014.
// Copyright (c) 2014 Michael Henry Pantaleon. All rights reserved.
//
// Version 1.0
// Version 1.0.1
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Classes/MHYahooParallaxCollectionViewLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Michael Henry Pantaleon on 18/07/2014.
// Copyright (c) 2014 Michael Henry Pantaleon. All rights reserved.
//
// Version 1.0
// Version 1.0.1
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Classes/MHYahooParallaxView.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Michael Henry Pantaleon on 18/07/2014.
// Copyright (c) 2014 Michael Henry Pantaleon. All rights reserved.
//
// Version 1.0
// Version 1.0.1
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@
1434BE261980003E00DE8257 /* Classes */ = {
isa = PBXGroup;
children = (
14F03040198EC60400F6EA24 /* MHYahooParallaxView.m */,
14F03041198EC60400F6EA24 /* MHYahooParallaxView.h */,
14F03040198EC60400F6EA24 /* MHYahooParallaxView.m */,
14F03042198EC60400F6EA24 /* MHYahooParallaxCollectionViewLayout.m */,
14F03043198EC60400F6EA24 /* MHYahooParallaxCollectionViewLayout.h */,
);
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#import "ViewController.h"
#import "MHYahooParallaxView.h"
#import "MHTsekotCell.h"
//#import "MHYahooWeatherParallaxCell.h"

@interface ViewController ()<MHYahooParallaxViewDatasource,MHYahooParallaxViewDelegate,UITableViewDelegate,UITableViewDataSource>

Expand All @@ -31,7 +30,6 @@ - (void)viewDidLoad
[parallaxView registerClass:[MHTsekotCell class] forCellWithReuseIdentifier:[MHTsekotCell reuseIdentifier]];
parallaxView.delegate = self;
parallaxView.datasource = self;
parallaxView.backgroundColor = [UIColor grayColor];
[self.view addSubview:parallaxView];

// Do any additional setup after loading the view, typically from a nib.
Expand Down Expand Up @@ -102,7 +100,6 @@ - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexP
return 568.0f;
}


- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell * cell;
if(indexPath.row == 0){
Expand Down Expand Up @@ -130,7 +127,6 @@ - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
[cell.contentView addSubview:svImage];
UIImageView * headerInfo = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"header_bg"]];


[cell.contentView addSubview:headerInfo];

CGRect headerFrame = headerInfo.frame;
Expand Down Expand Up @@ -168,8 +164,6 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
frame.origin.y = tv.contentOffset.y;
svImage.frame = frame;
svImage.zoomScale = 1 + (abs(MIN(tv.contentOffset.y,0))/320.0f);


}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
Expand Down
55 changes: 39 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,58 @@ MHYahooParallaxView
Parallax implementation control library inspired by Yahoo Weather and News Digest :)

## Screenshots

#### Default

- (UIImage*) parallaxView:(MHYahooParallaxView *)parallaxView imageForIndex:(NSInteger)index;


![Preview](http://iamkel.s3.amazonaws.com/github/MHParallaxIntro.gif)
![Preview](http://iamkel.s3.amazonaws.com/github/MHParallax.gif)

#### News Digest Sample Screenshot

![Preview](http://iamkel.s3.amazonaws.com/github/MHYahooParallaxView-NewsDigest.gif)

#### Custom ImageView Screenshot (Tsekot.net app - prototype)

- (MHYahooParallaxViewCell*) parallaxView:(MHYahooParallaxView *)parallaxView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL) shouldUseCustomCell; // Must return YES if using custom (the default value is NO)

![Preview](http://iamkel.s3.amazonaws.com/github/Tsekot.gif)

Designed and developed by [michaelhenry](https://github.com/michaelhenry)

## How to use
### Setup

MHYahooParallaxView _parallaxView = [[MHYahooParallaxView alloc]init];
_parallaxView = [[MHYahooParallaxView alloc]initWithFrame:CGRectMake(0.0f, 0.0f, self.view.frame.size.width, self.view.frame.size.height)];
_parallaxView.parallaxViewType = MHYahooParallaxViewTypeHorizontal;
_parallaxView.datasource = self;
_parallaxView.backgroundColor = [UIColor blackColor];
[self.view addSubview:_parallaxView];
MHYahooParallaxView * parallaxView = [[MHYahooParallaxView alloc]initWithFrame:CGRectMake(0.0f,0.0f, self.view.frame.size.width, self.view.frame.size.height)];
[parallaxView registerClass:[MHTsekotCell class] forCellWithReuseIdentifier:[MHTsekotCell reuseIdentifier]];
parallaxView.delegate = self;
parallaxView.datasource = self;
[self.view addSubview:parallaxView];

### Datasource

- (NSInteger) numberOfRows:(MHYahooParallaxView *)parallaxView;
- (UIImage*)parallaxView:(MHYahooParallaxView *)parallaxView imageForIndex:(NSInteger)index;
@required

- (NSInteger) numberOfRowsInParallaxView: (MHYahooParallaxView *)parallaxView;
- (UICollectionViewCell*) parallaxView:(MHYahooParallaxView *)parallaxView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

### Parallax Type

typedef enum {
MHYahooParallaxViewTypeHorizontal = 0,
MHYahooParallaxViewTypeVertical = 1
} MHYahooParallaxViewType;
### Delegate

@optional
- (void) parallaxViewDidScrollHorizontally:(MHYahooParallaxView *)parallaxView leftIndex:(NSInteger) leftIndex leftImageLeftMargin:(CGFloat) leftImageLeftMargin leftImageWidth:(CGFloat)leftImageWidth rightIndex:(NSInteger)rightIndex rightImageLeftMargin:(CGFloat)rightImageLeftMargin rightImageWidth:(CGFloat) rightImageWidth;

- (void) parallaxViewDidScrollVertically:(MHYahooParallaxView *)parallaxView topIndex:(NSInteger) topIndex topImageTopMargin:(CGFloat) topImageTopMargin topImageHeight:(CGFloat)topImageHeight bottomIndex:(NSInteger)bottomIndex bottomImageTopMargin:(CGFloat)bottomImageTopMargin bottomImageHeight:(CGFloat) bottomImageHeight;


## Example

The project has 2 targets that use as demo.

- Demo for News Digest (Tsekot.net Prototype app)
- Demo for Yahoo Weather




Expand All @@ -51,7 +74,7 @@ http://www.iamkel.net

## Licensing

Copyright (c) 2013 Michael Henry Pantaleon (http://www.iamkel.net). All rights reserved.
Copyright (c) 2014 Michael Henry Pantaleon (http://www.iamkel.net). All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down

0 comments on commit 7096ef4

Please sign in to comment.