From 84366368f3ef99a9dda7bcd73db62f4a329b082d Mon Sep 17 00:00:00 2001 From: Daniel Zanchi Date: Fri, 27 Oct 2017 18:12:41 +0200 Subject: [PATCH 1/6] Update AlertOnboarding.swift try --- AlertOnboarding/AlertOnboarding.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlertOnboarding/AlertOnboarding.swift b/AlertOnboarding/AlertOnboarding.swift index 060b91e..c617820 100644 --- a/AlertOnboarding/AlertOnboarding.swift +++ b/AlertOnboarding/AlertOnboarding.swift @@ -4,7 +4,7 @@ // // Created by Philippe on 26/09/2016. // Copyright © 2016 CookMinute. All rights reserved. -// +// Daniel Zanchi import UIKit From 808c920485a78d91c6e77bad7cadc49bcc07b832 Mon Sep 17 00:00:00 2001 From: Daniel Zanchi Date: Fri, 27 Oct 2017 18:15:08 +0200 Subject: [PATCH 2/6] Update AlertOnboarding.swift --- AlertOnboarding/AlertOnboarding.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/AlertOnboarding/AlertOnboarding.swift b/AlertOnboarding/AlertOnboarding.swift index c617820..15fbd37 100644 --- a/AlertOnboarding/AlertOnboarding.swift +++ b/AlertOnboarding/AlertOnboarding.swift @@ -4,7 +4,6 @@ // // Created by Philippe on 26/09/2016. // Copyright © 2016 CookMinute. All rights reserved. -// Daniel Zanchi import UIKit From 110bf109cab52fbf61c275bcd1ce06942a2767f9 Mon Sep 17 00:00:00 2001 From: Daniel Zanchi Date: Tue, 31 Oct 2017 18:04:45 +0100 Subject: [PATCH 3/6] Added Blur and ImageContentMode selectable. --- Pod/Classes/AlertChildPageViewController.swift | 5 +++++ Pod/Classes/AlertOnboarding.swift | 15 ++++++++++++--- Pod/Classes/AlertPageViewController.swift | 8 +++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Pod/Classes/AlertChildPageViewController.swift b/Pod/Classes/AlertChildPageViewController.swift index 435722e..b8c3504 100644 --- a/Pod/Classes/AlertChildPageViewController.swift +++ b/Pod/Classes/AlertChildPageViewController.swift @@ -23,4 +23,9 @@ class AlertChildPageViewController: UIViewController { override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } + + func changeContentModeForImages(contentMode: UIViewContentMode) { + print("changing content mode") + self.image.contentMode = contentMode + } } diff --git a/Pod/Classes/AlertOnboarding.swift b/Pod/Classes/AlertOnboarding.swift index 060b91e..d97e401 100644 --- a/Pod/Classes/AlertOnboarding.swift +++ b/Pod/Classes/AlertOnboarding.swift @@ -25,7 +25,7 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { open var buttonBottom: UIButton! fileprivate var container: AlertPageViewController! open var background: UIView! - + //PUBLIC VARS ------------------------ open var colorForAlertViewBackground: UIColor = UIColor.white @@ -50,6 +50,9 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { open var delegate: AlertOnboardingDelegate? + open var shouldBlur = false + open var imageContentMode = UIViewContentMode.scaleToFill + public init (arrayOfImage: [String], arrayOfTitle: [String], arrayOfDescription: [String]) { super.init(frame: CGRect(x: 0,y: 0,width: 0,height: 0)) @@ -78,14 +81,13 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { //----------------------------------------------------------------------------------------- open func show() { - //Update Color self.buttonBottom.backgroundColor = colorButtonBottomBackground self.backgroundColor = colorForAlertViewBackground self.buttonBottom.setTitleColor(colorButtonText, for: UIControlState()) self.buttonBottom.setTitle(self.titleSkipButton, for: UIControlState()) - self.container = AlertPageViewController(arrayOfImage: arrayOfImage, arrayOfTitle: arrayOfTitle, arrayOfDescription: arrayOfDescription, alertView: self) + self.container = AlertPageViewController(arrayOfImage: arrayOfImage, arrayOfTitle: arrayOfTitle, arrayOfDescription: arrayOfDescription, alertView: self, imageContentMode: self.imageContentMode) self.container.delegate = self self.insertSubview(self.container.view, aboveSubview: self) self.insertSubview(self.buttonBottom, aboveSubview: self) @@ -95,6 +97,13 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { return } + + + //here I check if I should blur the view ----------------------- + if self.shouldBlur { + self.background = UIVisualEffectView(effect: UIBlurEffect(style: .light)) + } + // Find current stop viewcontroller if let topController = getTopViewController() { let superView: UIView = topController.view diff --git a/Pod/Classes/AlertPageViewController.swift b/Pod/Classes/AlertPageViewController.swift index 06611a0..3a2ef4d 100644 --- a/Pod/Classes/AlertPageViewController.swift +++ b/Pod/Classes/AlertPageViewController.swift @@ -19,6 +19,8 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource, var pageControl: UIPageControl! var alertview: AlertOnboarding! + var imageContentView: UIViewContentMode! + //FOR DATA var arrayOfImage: [String]! var arrayOfTitle: [String]! @@ -32,12 +34,14 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource, var delegate: AlertPageViewDelegate? - init (arrayOfImage: [String], arrayOfTitle: [String], arrayOfDescription: [String], alertView: AlertOnboarding) { + init (arrayOfImage: [String], arrayOfTitle: [String], arrayOfDescription: [String], alertView: AlertOnboarding, imageContentMode icm: UIViewContentMode) { super.init(nibName: nil, bundle: nil) self.arrayOfImage = arrayOfImage self.arrayOfTitle = arrayOfTitle self.arrayOfDescription = arrayOfDescription self.alertview = alertView + + self.imageContentView = icm } required init(coder: NSCoder) { @@ -111,11 +115,13 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource, pageContentViewController = UINib(nibName: "AlertChildPageViewController", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! AlertChildPageViewController } + pageContentViewController.pageIndex = index // 0 let realIndex = arrayOfImage.count - index - 1 pageContentViewController.image.image = UIImage(named: arrayOfImage[realIndex]) + pageContentViewController.image.contentMode = self.imageContentView pageContentViewController.labelMainTitle.text = arrayOfTitle[realIndex] pageContentViewController.labelMainTitle.textColor = alertview.colorTitleLabel pageContentViewController.labelDescription.text = arrayOfDescription[realIndex] From d4cfc3dfdc476755cf021caed7a2ecd3f87f4ca0 Mon Sep 17 00:00:00 2001 From: Daniel Zanchi Date: Tue, 31 Oct 2017 18:06:18 +0100 Subject: [PATCH 4/6] improved image content mode, without method. --- Pod/Classes/AlertChildPageViewController.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Pod/Classes/AlertChildPageViewController.swift b/Pod/Classes/AlertChildPageViewController.swift index b8c3504..435722e 100644 --- a/Pod/Classes/AlertChildPageViewController.swift +++ b/Pod/Classes/AlertChildPageViewController.swift @@ -23,9 +23,4 @@ class AlertChildPageViewController: UIViewController { override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } - - func changeContentModeForImages(contentMode: UIViewContentMode) { - print("changing content mode") - self.image.contentMode = contentMode - } } From 3bcf3094acb57f0fee486a39ed14667c2148140a Mon Sep 17 00:00:00 2001 From: Daniel Zanchi Date: Tue, 31 Oct 2017 18:07:53 +0100 Subject: [PATCH 5/6] Added blur option and choose image content mode. --- AlertOnboarding/AlertOnboarding.swift | 16 +++++++++++++--- AlertOnboarding/AlertPageViewController.swift | 8 +++++++- AlertOnboarding/ViewController.swift | 7 ++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/AlertOnboarding/AlertOnboarding.swift b/AlertOnboarding/AlertOnboarding.swift index 15fbd37..d97e401 100644 --- a/AlertOnboarding/AlertOnboarding.swift +++ b/AlertOnboarding/AlertOnboarding.swift @@ -4,6 +4,7 @@ // // Created by Philippe on 26/09/2016. // Copyright © 2016 CookMinute. All rights reserved. +// import UIKit @@ -24,7 +25,7 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { open var buttonBottom: UIButton! fileprivate var container: AlertPageViewController! open var background: UIView! - + //PUBLIC VARS ------------------------ open var colorForAlertViewBackground: UIColor = UIColor.white @@ -49,6 +50,9 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { open var delegate: AlertOnboardingDelegate? + open var shouldBlur = false + open var imageContentMode = UIViewContentMode.scaleToFill + public init (arrayOfImage: [String], arrayOfTitle: [String], arrayOfDescription: [String]) { super.init(frame: CGRect(x: 0,y: 0,width: 0,height: 0)) @@ -77,14 +81,13 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { //----------------------------------------------------------------------------------------- open func show() { - //Update Color self.buttonBottom.backgroundColor = colorButtonBottomBackground self.backgroundColor = colorForAlertViewBackground self.buttonBottom.setTitleColor(colorButtonText, for: UIControlState()) self.buttonBottom.setTitle(self.titleSkipButton, for: UIControlState()) - self.container = AlertPageViewController(arrayOfImage: arrayOfImage, arrayOfTitle: arrayOfTitle, arrayOfDescription: arrayOfDescription, alertView: self) + self.container = AlertPageViewController(arrayOfImage: arrayOfImage, arrayOfTitle: arrayOfTitle, arrayOfDescription: arrayOfDescription, alertView: self, imageContentMode: self.imageContentMode) self.container.delegate = self self.insertSubview(self.container.view, aboveSubview: self) self.insertSubview(self.buttonBottom, aboveSubview: self) @@ -94,6 +97,13 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate { return } + + + //here I check if I should blur the view ----------------------- + if self.shouldBlur { + self.background = UIVisualEffectView(effect: UIBlurEffect(style: .light)) + } + // Find current stop viewcontroller if let topController = getTopViewController() { let superView: UIView = topController.view diff --git a/AlertOnboarding/AlertPageViewController.swift b/AlertOnboarding/AlertPageViewController.swift index 06611a0..3a2ef4d 100644 --- a/AlertOnboarding/AlertPageViewController.swift +++ b/AlertOnboarding/AlertPageViewController.swift @@ -19,6 +19,8 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource, var pageControl: UIPageControl! var alertview: AlertOnboarding! + var imageContentView: UIViewContentMode! + //FOR DATA var arrayOfImage: [String]! var arrayOfTitle: [String]! @@ -32,12 +34,14 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource, var delegate: AlertPageViewDelegate? - init (arrayOfImage: [String], arrayOfTitle: [String], arrayOfDescription: [String], alertView: AlertOnboarding) { + init (arrayOfImage: [String], arrayOfTitle: [String], arrayOfDescription: [String], alertView: AlertOnboarding, imageContentMode icm: UIViewContentMode) { super.init(nibName: nil, bundle: nil) self.arrayOfImage = arrayOfImage self.arrayOfTitle = arrayOfTitle self.arrayOfDescription = arrayOfDescription self.alertview = alertView + + self.imageContentView = icm } required init(coder: NSCoder) { @@ -111,11 +115,13 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource, pageContentViewController = UINib(nibName: "AlertChildPageViewController", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! AlertChildPageViewController } + pageContentViewController.pageIndex = index // 0 let realIndex = arrayOfImage.count - index - 1 pageContentViewController.image.image = UIImage(named: arrayOfImage[realIndex]) + pageContentViewController.image.contentMode = self.imageContentView pageContentViewController.labelMainTitle.text = arrayOfTitle[realIndex] pageContentViewController.labelMainTitle.textColor = alertview.colorTitleLabel pageContentViewController.labelDescription.text = arrayOfDescription[realIndex] diff --git a/AlertOnboarding/ViewController.swift b/AlertOnboarding/ViewController.swift index 8420cc2..d7e4ef9 100644 --- a/AlertOnboarding/ViewController.swift +++ b/AlertOnboarding/ViewController.swift @@ -42,8 +42,13 @@ class ViewController: UIViewController, AlertOnboardingDelegate { self.alertView.percentageRatioHeight = 0.5 self.alertView.percentageRatioWidth = 0.5 - */ + + self.alertView.imageContentMode = .scaleAspectFit + + self.alertView.shouldBlur = true + + */ self.alertView.show() From c74a8778d24ad6b23af11ea77c0334bd539329b4 Mon Sep 17 00:00:00 2001 From: Daniel Zanchi Date: Fri, 26 Jan 2018 14:00:34 +0100 Subject: [PATCH 6/6] Font changed and size of images. --- .../AlertChildPageViewController.xib | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/AlertOnboarding/AlertChildPageViewController.xib b/AlertOnboarding/AlertChildPageViewController.xib index a004aca..cb19457 100644 --- a/AlertOnboarding/AlertChildPageViewController.xib +++ b/AlertOnboarding/AlertChildPageViewController.xib @@ -1,12 +1,23 @@ - - + + + + + - + + + + MarkerFelt-Thin + + + MarkerFelt-Wide + + @@ -19,19 +30,19 @@ - - + + - - - + + - - + + + + + - + - + @@ -85,8 +99,8 @@ - +