diff --git a/Frameless/AppDefaults.swift b/Frameless/AppDefaults.swift index 43b6a6f..2c0c09d 100644 --- a/Frameless/AppDefaults.swift +++ b/Frameless/AppDefaults.swift @@ -12,6 +12,7 @@ enum AppDefaultKeys: String { case PanFromBottomGesture = "panFromBottom" case ForwardBackGesture = "panLeftRight" case TripleTapGesture = "tripleTap" + case NoBounceAnimation = "noBounceAnimation" case FramerBonjour = "framerConnect" case KeepAwake = "keepAwake" } diff --git a/Frameless/AppDelegate.swift b/Frameless/AppDelegate.swift index fb860fb..2cf7d2b 100644 --- a/Frameless/AppDelegate.swift +++ b/Frameless/AppDelegate.swift @@ -46,6 +46,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ForwardBackGesture.rawValue) == nil { NSUserDefaults.standardUserDefaults().setValue(true, forKey: AppDefaultKeys.ForwardBackGesture.rawValue) } + if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.NoBounceAnimation.rawValue) == nil { + NSUserDefaults.standardUserDefaults().setValue(false, forKey: AppDefaultKeys.NoBounceAnimation.rawValue) + } if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.FramerBonjour.rawValue) == nil { NSUserDefaults.standardUserDefaults().setValue(true, forKey: AppDefaultKeys.FramerBonjour.rawValue) } diff --git a/Frameless/Base.lproj/Main.storyboard b/Frameless/Base.lproj/Main.storyboard index d244826..1dc220d 100644 --- a/Frameless/Base.lproj/Main.storyboard +++ b/Frameless/Base.lproj/Main.storyboard @@ -19,6 +19,8 @@ ClearSans ClearSans ClearSans + ClearSans + ClearSans @@ -231,6 +233,39 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -302,6 +337,7 @@ + diff --git a/Frameless/SettingsTableViewController.swift b/Frameless/SettingsTableViewController.swift index f5d68d8..d25cf62 100644 --- a/Frameless/SettingsTableViewController.swift +++ b/Frameless/SettingsTableViewController.swift @@ -14,6 +14,7 @@ class SettingsTableViewController: UITableViewController { @IBOutlet weak var _swipeUpSwitch: UISwitch! @IBOutlet weak var _tripleTapSwitch: UISwitch! @IBOutlet weak var _browserSwitch: UISwitch! + @IBOutlet weak var _bounceSwitch: UISwitch! @IBOutlet weak var _framerSwitch: UISwitch! @IBOutlet weak var _sleepSwitch: UISwitch! @@ -24,6 +25,7 @@ class SettingsTableViewController: UITableViewController { _swipeUpSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.PanFromBottomGesture.rawValue) as! Bool _tripleTapSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.TripleTapGesture.rawValue) as! Bool _browserSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ForwardBackGesture.rawValue) as! Bool + _bounceSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.NoBounceAnimation.rawValue) as! Bool _framerSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.FramerBonjour.rawValue) as! Bool _sleepSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.KeepAwake.rawValue) as! Bool } @@ -68,6 +70,11 @@ class SettingsTableViewController: UITableViewController { NSUserDefaults.standardUserDefaults().setValue(value, forKey: AppDefaultKeys.ForwardBackGesture.rawValue) } + @IBAction func toggleBounceSwitch(sender: AnyObject) { + var value = (sender as! UISwitch).on + NSUserDefaults.standardUserDefaults().setValue(value, forKey: AppDefaultKeys.NoBounceAnimation.rawValue) + } + @IBAction func toggleFramerSwitch(sender: AnyObject) { var value = (sender as! UISwitch).on NSUserDefaults.standardUserDefaults().setValue(value, forKey: AppDefaultKeys.FramerBonjour.rawValue) diff --git a/Frameless/ViewController.swift b/Frameless/ViewController.swift index 41af1fa..177aa78 100644 --- a/Frameless/ViewController.swift +++ b/Frameless/ViewController.swift @@ -315,6 +315,11 @@ class ViewController: UIViewController, UISearchBarDelegate, FramelessSearchBarD } func loadURL(urlString: String) { + + // disable the typical webview bounce animations and keep the scrollView + // as it is. + _webView?.scrollView.bounces = !(NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.NoBounceAnimation.rawValue) as! Bool) + let addrStr = httpifyString(urlString) let addr = NSURL(string: addrStr) if let webAddr = addr {