Created
July 29, 2013 10:16
-
-
Save zapsleep/6103396 to your computer and use it in GitHub Desktop.
Getter for parallaxView w/o gyro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(DVParallaxView *)parallaxView { | |
if (!_parallaxView) { | |
_parallaxView = [[DVParallaxView alloc] initWithFrame:self.view.bounds]; | |
[_parallaxView setBackgroundImage:[UIImage imageNamed:@"galaxy2"]]; | |
UIImageView *earth = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"earth"]]; | |
earth.frame = (CGRect) {.origin = CGPointMake(CGRectGetMidX(self.view.bounds) - earth.image.size.width/2.f, | |
CGRectGetMidY(self.view.bounds) - earth.image.size.height/2.f), | |
.size = earth.frame.size}; | |
[_parallaxView addSubview:earth]; | |
UIImageView *moon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"moon"]]; | |
moon.frame = (CGRect) {.origin = CGPointMake(CGRectGetMidX(self.view.bounds) + 30.f, | |
CGRectGetMidY(self.view.bounds) + 30.f), | |
.size = moon.frame.size}; | |
[_parallaxView addSubview:moon]; | |
[_parallaxView setFrontView:self.frontView]; | |
} | |
return _parallaxView; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment