I'm working on a project for school where I will be having two images (a background and a foreground). The end goal will be that when you pan with your finger the foreground image will hide it self line by line, rather then pushing it off screen, displaying the image below. Kind of like this picture.
http://postimage.org/image/3oowvdvrl/
I am working on just the masking part as of now using the cliptobounds as the thing clipping the view.
The problem I am having right now is getting the view to clip from the left side rather then clipping from the middle. Like the photo below.
http://postimage.org/image/tvbv2qsyj
Is there a way to get it to clip from the left side rather then even out the clipping on each side? Also is calling cliptobounds the best way to do this panning and hiding the image?
Thanks for the help!
Code:
[super viewDidLoad];
bottomView.autoresizesSubviews = NO;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGPoint pointFrame = CGPointMake(0, 0);
CGSize sizeFrame= CGSizeMake(100, 100);
CGPoint pointBound = CGPointMake(0, 0);
CGSize sizeBound= CGSizeMake(0, 0);
CGFloat subtraction = 50.0;
pointBound.x = 0.0 ;
pointBound.y = 0.0;
sizeBound.width = screenBounds.size.width - subtraction;
sizeBound.height = screenBounds.size.height;
pointFrame.x = 0.0-subtraction;
pointFrame.y = 0.0;
sizeFrame.width = screenBounds.size.width;
sizeFrame.height = screenBounds.size.height;
CGRect rectBound = CGRectMake(pointBound.x, pointBound.y, sizeBound.width, sizeBound.height);
//CGRect rectFrame = CGRectMake(pointFrame.x, pointFrame.y, sizeFrame.width, sizeFrame.height);
bottomView.backgroundColor = [UIColor orangeColor];
//imageView.frame = rectFrame;
bottomView.bounds = rectBound;
//imageView.layer.anchorPoint = CGPointMake(0, 0.5);
bottomView.clipsToBounds = YES;
//bottomView.center = CGPointMake(150,200 );
bottomView.hidden = NO;
imageView.hidden = NO;