-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComposeRequestViewController.swift
More file actions
54 lines (43 loc) · 1.71 KB
/
ComposeRequestViewController.swift
File metadata and controls
54 lines (43 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// ComposeRequestViewController.swift
// MealPal
//
// Created by yunchu on 10/10/15.
// Copyright © 2015 AmerPe Studio. All rights reserved.
//
import Foundation
import UIKit
import Parse
class ComposeRequestViewController: UIViewController,UITextFieldDelegate,UITextViewDelegate {
@IBOutlet weak var allergtextfield: UITextField!
@IBOutlet weak var time: UITextField!
@IBOutlet weak var location: UITextField!
@IBOutlet weak var requestcontent: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
self.allergtextfield.delegate = self
self.time.delegate = self
self.location.delegate = self
self.requestcontent.delegate = self
}
@IBAction func Done(sender: UIBarButtonItem) {
// var dr = self.storyboard?.instantiateViewControllerWithIdentifier("requestlist") as! RequestListViewController
// self.presentViewController(dr, animated: true, completion: nil)
var request = PFObject(className:"Requests")
request["time"] = time.text
request["location"] = location.text
request["username"] = PFUser.currentUser()?.username
request["emailaddress"] = PFUser.currentUser()?.email
request["allergies"] = allergtextfield.text
request["requestcontent"] = requestcontent.text
request.saveInBackgroundWithBlock {
(success: Bool, error: NSError?) -> Void in
if (success) {
// The object has been saved.
} else {
// There was a problem, check error.description
}
}
self.performSegueWithIdentifier("backtohome", sender: self)
}
}