@@ -16,7 +16,7 @@ class QuantitativeJobDemand5ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (54/72)"
var backbutton = UIBarButtonItem(title: "54/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class ChasteningNormOrientation1ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (66/72)"
var backbutton = UIBarButtonItem(title: "66/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class ChasteningNormOrientation2ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (67/72)"
var backbutton = UIBarButtonItem(title: "67/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class ChasteningNormOrientation3ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (68/72)"
var backbutton = UIBarButtonItem(title: "68/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class ChasteningNormOrientation4ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (69/72)"
var backbutton = UIBarButtonItem(title: "69/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class ChasteningNormOrientation5ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (70/72)"
var backbutton = UIBarButtonItem(title: "70/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class ChasteningNormOrientation6ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (71/72)"
var backbutton = UIBarButtonItem(title: "71/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class ChasteningNormOrientation7ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (72/72)"
var backbutton = UIBarButtonItem(title: "72/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class PowerDistanceOrientation1ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (60/72)"
var backbutton = UIBarButtonItem(title: "60/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class PowerDistanceOrientation2ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (61/72)"
var backbutton = UIBarButtonItem(title: "61/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class PowerDistanceOrientation3ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (62/72)"
var backbutton = UIBarButtonItem(title: "62/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class PowerDistanceOrientation4ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (63/72)"
var backbutton = UIBarButtonItem(title: "63/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class PowerDistanceOrientation5ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (64/72)"
var backbutton = UIBarButtonItem(title: "64/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class PowerDistanceOrientation6ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (65/72)"
var backbutton = UIBarButtonItem(title: "65/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -14,7 +14,7 @@ class AgeViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (2/72)"
var backbutton = UIBarButtonItem(title: "2/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -25,9 +25,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Parse.setApplicationId("LgTpOBlioAGaP88D1WTxn5P4L2GWkBDVSEDBTgLu", clientKey: "2lGpw0C6m6HmJaq8imPuGrH1N28gXI3jKqyr9M4X")

window?.backgroundColor = UIColor.whiteColor()
let v = UIView(frame: window!.frame)
v.backgroundColor = UIColor(patternImage: UIImage(named: "bg.png")!)
window?.addSubview(v)

UITabBar.appearance().tintColor = UIColor(red:0.161, green:0.733, blue:0.937, alpha:1)



Large diffs are not rendered by default.

@@ -0,0 +1,41 @@
//
// ChangeDateViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/3.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class ChangeDateViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

UITabBar.appearance().tintColor = UIColor(red:0.600, green:0.784, blue:0.447, alpha:1)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
@@ -15,7 +15,7 @@ class CompanyLevelViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (5/72)"
var backbutton = UIBarButtonItem(title: "5/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -0,0 +1,66 @@
//
// DayQuestionareViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/5.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class DayQuestionareViewController: UIViewController {

@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
printFonts()
}

@IBAction func startButtonClicked(sender: AnyObject) {
// check date now
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "HH:mm"

print(formatter.stringFromDate(NSDate()))

QuestionareNotification.clearNotification()
QuestionareNotification.setNotificationAfterFewDays(2)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func printFonts() {
let fontFamilyNames = UIFont.familyNames()
for familyName in fontFamilyNames {
print("------------------------------")
print("Font Family Name = [\(familyName)]")
let names = UIFont.fontNamesForFamilyName(familyName)
print("Font Names = [\(names)]")
}
}

/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}

extension NSDate {
var timeOfLocalTimeZone: NSDate {
return NSDate()
}
}
@@ -15,7 +15,7 @@ class DepartmentPickerViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (6/72)"
var backbutton = UIBarButtonItem(title: "6/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -0,0 +1,41 @@
//
// DesignerViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/3.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class DesignerViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

UITabBar.appearance().tintColor = UIColor(red:0.729, green:0.600, blue:0.776, alpha:1)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
@@ -14,7 +14,7 @@ class EducationalBackgroundPickerViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (3/72)"
var backbutton = UIBarButtonItem(title: "3/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -14,7 +14,7 @@ class FifthPartConfirmViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
title = "第五部份確認"
@@ -14,7 +14,7 @@ class FirstPartConfirmViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
title = "第一部份總結"
@@ -14,7 +14,7 @@ class FirstPartStartViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
title = "第一部份"
@@ -14,7 +14,7 @@ class FourthPartConfirmViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
title = "第四部份確認"
@@ -11,7 +11,7 @@ import UIKit
class HintOnceViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
title = "前言"
@@ -17,7 +17,7 @@ class HowLongStayingInCompanyViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)
yearTextField.delegate = self
monthTextField.delegate = self

@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "closeButton.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "closeButton@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "closeButton@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "designer.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "designer@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "designer@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "doques.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "doques@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "doques@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "explain.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "explain@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "explain@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "progress.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "progress@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "progress@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "resetDate.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "resetDate@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "resetDate@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2</string>
<string>4</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
@@ -11,7 +11,7 @@ import UIKit
class InitialInformationViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
}
@@ -0,0 +1,41 @@
//
// IntroductionViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/3.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class IntroductionViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

UITabBar.appearance().tintColor = UIColor(red:0.369, green:0.761, blue:0.776, alpha:1)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
@@ -0,0 +1,41 @@
//
// MainQuestionareViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/3.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class MainQuestionareViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

UITabBar.appearance().tintColor = UIColor(red:0.161, green:0.733, blue:0.937, alpha:1)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
@@ -14,7 +14,7 @@ class MiddleOfSecondPartViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "說明"
var backbutton = UIBarButtonItem(title: "說明", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -0,0 +1,41 @@
//
// ProgressViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/3.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class ProgressViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

UITabBar.appearance().tintColor = UIColor(red:0.424, green:0.573, blue:0.800, alpha:1)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
@@ -0,0 +1,111 @@
//
// QUestionareNotification.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/6.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit
import Foundation

class QuestionareNotification {

class func clearNotification() {
UIApplication.sharedApplication().cancelAllLocalNotifications()
}

class func setNotificationAfterFewDays(days: Int) {
let calendar = NSCalendar.currentCalendar()
let component = NSDateComponents()
let now = NSDate()
component.year = now.year
component.month = now.month
component.day = now.day + days
component.hour = 9
component.minute = 0
component.second = 0
calendar.timeZone = NSTimeZone.defaultTimeZone()
var dateToFire = calendar.dateFromComponents(component)

let localNotification = UILocalNotification()
localNotification.timeZone = NSTimeZone.defaultTimeZone()
localNotification.fireDate = dateToFire
localNotification.alertBody = "請填寫早上問卷!"
localNotification.soundName = "default"

UIApplication.sharedApplication().scheduleLocalNotification(localNotification)

component.hour = 14
print(component)
dateToFire = calendar.dateFromComponents(component)
let localNotification2 = UILocalNotification()
localNotification2.timeZone = NSTimeZone.defaultTimeZone()
localNotification2.fireDate = dateToFire
localNotification2.alertBody = "請填寫中午問卷!"
localNotification2.soundName = "default"
UIApplication.sharedApplication().scheduleLocalNotification(localNotification2)

component.hour = 18
print(component)
dateToFire = calendar.dateFromComponents(component)
let localNotification3 = UILocalNotification()
localNotification3.timeZone = NSTimeZone.defaultTimeZone()
localNotification3.fireDate = dateToFire
localNotification3.alertBody = "請填寫晚上問卷!"
localNotification3.soundName = "default"
UIApplication.sharedApplication().scheduleLocalNotification(localNotification3)

print(UIApplication.sharedApplication().scheduledLocalNotifications?.count)
}
}

extension NSDate {
var year: Int {
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "yyyy"
let year = Int(formatter.stringFromDate(self))
return year!
}

var month: Int {
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "MM"
let month = Int(formatter.stringFromDate(self))
return month!
}

var day: Int {
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "dd"
let day = Int(formatter.stringFromDate(self))
return day!
}

var hour: Int {
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "HH"
let h = Int(formatter.stringFromDate(self))
return h!
}

var minute: Int {
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "mm"
let m = Int(formatter.stringFromDate(self))
return m!
}

var second: Int {
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "ss"
let s = Int(formatter.stringFromDate(self))
return s!
}
}
@@ -0,0 +1,63 @@
//
// ResetNotiDateViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/7.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class ResetNotiDateViewController: UIViewController {

@IBOutlet weak var dayTextField: UITextField!

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
dayTextField.delegate = self
let tap = UITapGestureRecognizer(target: self, action: "tap")
self.view.addGestureRecognizer(tap)
}

func tap() {
self.dayTextField.resignFirstResponder()
self.view.endEditing(true)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func closeButtonClicked() {
self.dismissViewControllerAnimated(true, completion: nil)
}

@IBAction func resetDateClicked() {
if let dayToSet = Int(dayTextField.text!) {
UserSetting.setNextWorkingDay(dayToSet)
closeButtonClicked()
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}

extension ResetNotiDateViewController: UITextFieldDelegate {
func textFieldShouldReturn(textField: UITextField) -> Bool {
if textField == dayTextField {
dayTextField.resignFirstResponder()
}
return true
}
}
@@ -15,7 +15,7 @@ class SecondPartBossPeopleViewController: UIViewController {

@IBOutlet weak var peopleTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (9/72)"
var backbutton = UIBarButtonItem(title: "9/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -15,7 +15,7 @@ class SecondPartBossSexPickerViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (8/72)"
var backbutton = UIBarButtonItem(title: "8/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -14,7 +14,7 @@ class SecondPartConfirmViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
title = "第二部份確認"
@@ -13,7 +13,7 @@ class SecondPartStartViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
}
@@ -16,7 +16,7 @@ class SecondPartWorkTogetherTimeViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (10/72)"
var backbutton = UIBarButtonItem(title: "10/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -14,7 +14,7 @@ class SexPickerViewController: UIViewController {
let sex = ["男性", "女性"]
var user: PersonalInformation!
override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (1/72)"
var backbutton = UIBarButtonItem(title: "1/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -0,0 +1,59 @@
//
// ShowDetailNotiDateViewController.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/7.
// Copyright © 2015年 David. All rights reserved.
//
import UIKit

class ShowDetailNotiDateViewController: UIViewController {

@IBOutlet weak var contentLabel: UILabel!

override func viewDidLoad() {
super.viewDidLoad()

setView()

}

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

setView()
}

func setView() {
// Do any additional setup after loading the view.
let nextWorkingDay = UserSetting().nextWorkingDay
let formatter = NSDateFormatter()
// formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.dateFormat = "MM-dd"
if nextWorkingDay != nil {
let s = formatter.stringFromDate(nextWorkingDay!)
contentLabel.text = "目前設定的下次上班日:" + s
} else {
contentLabel.text = "目前設定的下次上班日:" + "尚未設定"
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func closeButtonClicked() {
self.dismissViewControllerAnimated(true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
@@ -14,7 +14,7 @@ class SixthPartConfirmViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
title = "第六部份確認"
@@ -0,0 +1,26 @@
//
// UserSetting.swift
// AnnGiNoCoreData
//
// Created by David on 2015/10/7.
// Copyright © 2015年 David. All rights reserved.
//

import Foundation

class UserSetting {
struct Key {
static let nextWorkingDay = "nextWorkingDay"
}
var nextWorkingDay: NSDate? {
get {
let ud = NSUserDefaults.standardUserDefaults()
return ud.objectForKey(Key.nextWorkingDay) as? NSDate
}
}
class func setNextWorkingDay(day: Int) {
let nextWorkingDay = NSDate().dateByAddingTimeInterval(60*60*24*Double(day))
let ud = NSUserDefaults.standardUserDefaults()
ud.setObject(nextWorkingDay, forKey: Key.nextWorkingDay)
}
}
@@ -11,7 +11,7 @@ import UIKit
class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)
// Do any additional setup after loading the view, typically from a nib.
}

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -15,7 +15,7 @@ class Authoritarian1ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (11/72)"
var backbutton = UIBarButtonItem(title: "11/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class Authoritarian2ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (12/72)"
var backbutton = UIBarButtonItem(title: "12/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class Authoritarian3ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (13/72)"
var backbutton = UIBarButtonItem(title: "13/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class Authoritarian4ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (14/72)"
var backbutton = UIBarButtonItem(title: "14/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -16,7 +16,7 @@ class Authoritarian5ViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (15/72)"
var backbutton = UIBarButtonItem(title: "15/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -14,7 +14,7 @@ class CompanyInfoViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
var tap = UITapGestureRecognizer(target: self, action: "tap")
@@ -16,7 +16,7 @@ class CompanyKindViewController: UIViewController {

@IBOutlet weak var other: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

title = "初始問卷 (7/72)"
var backbutton = UIBarButtonItem(title: "7/72", style: UIBarButtonItemStyle.Done, target: nil, action: nil)
@@ -14,7 +14,7 @@ class DepartmentInfoViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
var tap = UITapGestureRecognizer(target: self, action: "tap")
@@ -14,7 +14,7 @@ class EMAILInfoViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
var tap = UITapGestureRecognizer(target: self, action: "tap")
@@ -14,7 +14,7 @@ class NameInfoViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
user = PersonalInformation()
@@ -14,7 +14,7 @@ class TelInfoViewController: UIViewController {
var user: PersonalInformation!

override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad(); self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

// Do any additional setup after loading the view.
var tap = UITapGestureRecognizer(target: self, action: "tap")