I am currently trying to make it so that when the user uses my app, the user will see a animation view that says, "Slide Left to Bring out Menu!" I want this view to not be shown once the user slides left to bring out the menu.
Here are some screenshots/diagrams showing what I mean:
I have tried some code that I have looked up on the internet such as(animView being the view containing the label, "Slide Left to Bring Out Menu"), however this solution did not work:
if (self.revealViewController().frontViewPosition != FrontViewPosition.left) {
animView.isHidden = true
}
else if (self.revealViewController().frontViewPosition == FrontViewPosition.left){
animView.isHidden = false
}
EDIT: I have tried the proposed solutions in the comments below, however I am not sure as to how to use this. Below is what I have tried:
func revealController(revealController: SWRevealViewController!, didMoveToPosition position: FrontViewPosition) {
switch(position){
case FrontViewPosition.leftSideMost: break
animView.isHidden = true
default:
break
}
}
FULL CODE IN CLASS ASSOCIATED WITH ANIMVIEW
import Foundation
import UIKit
import SVProgressHUD
import Canvas
class WebViewHome: UIViewController, UIWebViewDelegate, SWRevealViewControllerDelegate{
@IBOutlet weak var WebViewTst: UIWebView!
@IBOutlet weak var animView: CSAnimationView!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.topItem!.title = "Home"
let URL = NSURL(string: "https://gunnoracle.com/")
WebViewTst.loadRequest(NSURLRequest(url: URL! as URL) as URLRequest)
let topSpace = -190
let bottomSpace = -3045
let leftSpace = -40
let rightSpace = -40
WebViewTst.scrollView.contentInset = UIEdgeInsets(top: CGFloat(topSpace), left: CGFloat(leftSpace), bottom: CGFloat(bottomSpace), right: CGFloat(rightSpace))
WebViewTst.scrollView.bounces = false
WebViewTst.scrollView.maximumZoomScale = 1.0
WebViewTst.scrollView.minimumZoomScale = 1.0
WebViewTst.delegate = self
}
private func revealController(revealController: SWRevealViewController!, didMoveToPosition position: FrontViewPosition) {
if (revealController.frontViewPosition == FrontViewPosition.leftSide){
}
else{
}
}
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
switch navigationType {
case .linkClicked:
let topSpace = -170
let bottomSpace = -2840
let leftSpace = -40
let rightSpace = -40
animView.startCanvasAnimation()
WebViewTst.scrollView.contentInset = UIEdgeInsets(top: CGFloat(topSpace), left: CGFloat(leftSpace), bottom: CGFloat(bottomSpace), right: CGFloat(rightSpace))
WebViewTst.scrollView.bounces = false
WebViewTst.scrollView.maximumZoomScale = 1.0
WebViewTst.scrollView.minimumZoomScale = 1.0
WebViewTst.delegate = self
default:
break
}
return true
}
func webViewDidStartLoad(_ webView: UIWebView) {
SVProgressHUD.show(withStatus: "Loading...")
SVProgressHUD.setDefaultStyle(SVProgressHUDStyle.dark)
SVProgressHUD.setRingThickness(1.0)
NSLog("Webview has started loading")
}
func webViewDidFinishLoad(_ webView: UIWebView) {
SVProgressHUD.dismiss()
NSLog("Webview has successfully loaded")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}