Skip to content
Snippets Groups Projects
Commit c0963fb5 authored by jakobsbode's avatar jakobsbode
Browse files

Onboarding is using colours correctly

parent eb956208
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,11 @@
@property (nonatomic, strong) UIImage *backgroundImage;
/**
* @brief The background imageView presented. if a backgroundimage is shown.
*/
@property (nonatomic) UIImageView *backgroundImageView;
/**
* @brief Determines whether or not the background will be masked. The default value of this property is YES.
*/
......@@ -135,4 +140,6 @@
*/
- (void)moveNextPage;
- (void)fadeBackground:(UIImage *) newImage;
@end
......@@ -52,6 +52,9 @@ static NSString * const kSkipButtonText = @"Skip";
return nil;
}
//self.view.backgroundColor = UIColor.whiteColor;
//self.backgroundImageViewl = [[UIImageView alloc] initWithFrame:self.view.bounds];
self.backgroundImage = backgroundImage;
return self;
......@@ -90,7 +93,7 @@ static NSString * const kSkipButtonText = @"Skip";
self.viewControllers = contents;
// Set the default properties
self.shouldMaskBackground = YES;
self.shouldMaskBackground = NO;//YES;
self.shouldBlurBackground = NO;
self.shouldFadeTransitions = NO;
self.fadePageControlOnLastPage = NO;
......@@ -162,15 +165,16 @@ static NSString * const kSkipButtonText = @"Skip";
[self blurBackground];
}
UIImageView *backgroundImageView;
self.backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
//UIImageView *backgroundImageView = self.backgroundImageViewl;
// create the background image view and set it to aspect fill so it isn't skewed
if (self.backgroundImage) {
backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
backgroundImageView.clipsToBounds = YES;
backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;
[backgroundImageView setImage:self.backgroundImage];
[self.view addSubview:backgroundImageView];
self.backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
self.backgroundImageView.clipsToBounds = YES;
self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.backgroundImageView setImage:self.backgroundImage];
//[self.view addSubview:self.backgroundImageView];
}
// as long as the shouldMaskBackground setting hasn't been set to NO, we want to
......@@ -201,8 +205,8 @@ static NSString * const kSkipButtonText = @"Skip";
[self.pageVC.view sendSubviewToBack:backgroundMaskView];
// send the background image view to the back if we have one
if (backgroundImageView) {
[self.pageVC.view sendSubviewToBack:backgroundImageView];
if (self.backgroundImageView) {
[self.pageVC.view sendSubviewToBack:self.backgroundImageView];
}
// otherwise send the video view to the back if we have one
......@@ -501,4 +505,41 @@ static NSString * const kSkipButtonText = @"Skip";
self.backgroundImage = outputImage;
}
- (void) fadeBackground:(UIImage *)newImage {
self.backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
//UIImageView *backgroundImageView = self.backgroundImageViewl;
// create the background image view and set it to aspect fill so it isn't skewed
if (self.backgroundImage) {
self.backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
self.backgroundImageView.clipsToBounds = YES;
self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.backgroundImageView setImage:self.backgroundImage];
[self.view addSubview:self.backgroundImageView];
}
UIImageView *oldImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
[oldImageView setImage:self.backgroundImage];
UIImageView * newImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
[newImageView setImage:newImage];
newImageView.alpha = 0;
oldImageView.clipsToBounds = YES;
oldImageView.contentMode = UIViewContentModeScaleAspectFill;
newImageView.clipsToBounds = YES;
newImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.view insertSubview: newImageView aboveSubview: self.backgroundImageView];
[self.view insertSubview: oldImageView aboveSubview: newImageView];
[UIView animateWithDuration: 10.0 delay: 0.0 options: UIViewAnimationOptionCurveEaseInOut animations: ^{
oldImageView.alpha = 0;
newImageView.alpha = 1;
} completion: ^(BOOL completed){
self.backgroundImageView.image = newImage;
self.backgroundImage = newImage;
[newImageView removeFromSuperview];
[oldImageView removeFromSuperview];
[self.view setNeedsDisplay];
}];
}
@end
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment