Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Commit

Permalink
Closed #1
Browse files Browse the repository at this point in the history
  • Loading branch information
YOUR NAME committed May 9, 2016
1 parent ddd4928 commit 20f399e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Binary file modified RPI Tours/.DS_Store
Binary file not shown.
14 changes: 10 additions & 4 deletions RPI Tours/RPI Tours/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import UIKit

class SettingsViewController: UITableViewController {

let defaults = NSUserDefaults.standardUserDefaults()


//MARK: IBOutlets

Expand All @@ -22,11 +23,10 @@ class SettingsViewController: UITableViewController {
@IBAction func triggeredSave(sender: AnyObject) {

//Load the store
let defaults = NSUserDefaults.standardUserDefaults()

//Set the setting
defaults.setObject(measurementTypeSelector.titleForSegmentAtIndex(measurementTypeSelector.selectedSegmentIndex), forKey: "system")

self.defaults.setObject(measurementTypeSelector.titleForSegmentAtIndex(measurementTypeSelector.selectedSegmentIndex), forKey: "system")
self.defaults.setObject(measurementTypeSelector.selectedSegmentIndex, forKey: "savedIndex")

//Prompt the user with an alert
let alert = UIAlertController(title: "System", message: "Settings Saved!", preferredStyle: .Alert)
Expand All @@ -42,6 +42,12 @@ class SettingsViewController: UITableViewController {

//MARK: System Functions
override func viewDidLoad() {

if self.defaults.objectForKey("savedIndex") != nil{

self.measurementTypeSelector.selectedSegmentIndex = ((self.defaults.objectForKey("savedIndex")) as? Int)!
}

super.viewDidLoad()


Expand Down

0 comments on commit 20f399e

Please sign in to comment.