diff --git a/Vendoo.xcodeproj/project.pbxproj b/Vendoo.xcodeproj/project.pbxproj
index 5715c21..9d3bd66 100644
--- a/Vendoo.xcodeproj/project.pbxproj
+++ b/Vendoo.xcodeproj/project.pbxproj
@@ -432,7 +432,7 @@
TargetAttributes = {
3E6CC3521CF2A94B00E00A70 = {
CreatedOnToolsVersion = 7.3.1;
- DevelopmentTeam = AP9PJ45KS8;
+ DevelopmentTeam = TYC89UNAS3;
};
3E6CC3681CF2A94B00E00A70 = {
CreatedOnToolsVersion = 7.3.1;
diff --git a/Vendoo/Info.plist b/Vendoo/Info.plist
index 364caa0..f14f845 100644
--- a/Vendoo/Info.plist
+++ b/Vendoo/Info.plist
@@ -58,13 +58,13 @@
NSAppTransportSecurity
- NSIncludeSubdomains
+ NSAllowsArbitraryLoads
NSExceptionAllowsInsecureHTTPLoads
NSExceptionMinimumTLSVersion
TLSv1.1
- NSAllowsArbitraryLoads
+ NSIncludeSubdomains
UILaunchStoryboardName
diff --git a/Vendoo/ItemImagePickerViewController.swift b/Vendoo/ItemImagePickerViewController.swift
index 3114c1c..61863ab 100644
--- a/Vendoo/ItemImagePickerViewController.swift
+++ b/Vendoo/ItemImagePickerViewController.swift
@@ -18,18 +18,24 @@ class ItemImagePickerViewController: UIViewController {
//Outlets
@IBOutlet weak var cancelButton: UIButton!
+ @IBOutlet weak var descriptionLabel: UILabel!
+ @IBOutlet weak var quantityLabel: UILabel!
@IBOutlet weak var possibleItemImageMain: UIImageView!
@IBOutlet weak var possibleItemImage2: UIImageView!
@IBOutlet weak var possibleItemImage3: UIImageView!
@IBOutlet weak var possibleItemImage4: UIImageView!
@IBOutlet weak var possibleItemImage5: UIImageView!
@IBOutlet weak var itemQuantity: UITextField!
+ @IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var itemName: UITextField!
@IBOutlet weak var itemDescription: UITextView!
@IBOutlet weak var itemPrice: UITextField!
+ @IBOutlet weak var textEditScrollView: UIScrollView!
@IBOutlet weak var categoryPicker: UIPickerView!
+ @IBOutlet weak var priceLabel: UILabel!
@IBOutlet weak var containerScrollView: UIScrollView!
+
//class variables
var pickerData: [String] = [String]()
var itemImagesSelections = [false,false,false,false,false]
@@ -53,53 +59,24 @@ class ItemImagePickerViewController: UIViewController {
self.itemQuantity.delegate = self
self.itemPrice.delegate = self
self.picker.delegate = self
+ addEditableItemsToScrollView()
+ // Input data into the Array:
+ pickerData = ["Category 1", "Category 2", "Category 3", "Category 4", "Category 5", "Category 6"]
let tapGestureMain = UITapGestureRecognizer(target: self, action: #selector(ItemImagePickerViewController.takePicture))
self.view.addGestureRecognizer(tapGestureMain)
-
- if(self.isEditing) {
- self.itemName.text = self.currentInformation["title"] as? String
- self.itemDescription.text = self.currentInformation["description"] as? String
- self.itemQuantity.text = self.currentInformation["quantity"] as? String
- self.itemPrice.text = self.currentInformation["price"] as? String
-
- //@FIXME: Cancel button not changing to Back button label
- dispatch_async(dispatch_get_main_queue(), {
- self.cancelButton.titleLabel?.text = "Back"
- })
-
- var images = (self.currentInformation["images"] as? [UIImage])!
- for i in 0...(images.count - 1) {
- switch i {
- case 0:
- self.possibleItemImageMain.image = images[i]
- self.itemImagesSelections[i] = true
- break
- case 1:
- self.possibleItemImage2.image = images[i]
- self.itemImagesSelections[i] = true
- break
- case 2:
- self.possibleItemImage3.image = images[i]
- self.itemImagesSelections[i] = true
- break
- case 3:
- self.possibleItemImage4.image = images[i]
- self.itemImagesSelections[i] = true
- break
- case 4:
- self.possibleItemImage5.image = images[i]
- self.itemImagesSelections[i] = true
- break
- default:
- break
- }
- }
-
- }
+
+
+ //self.possibleItemImageMain.addGestureRecognizer(tapGestureMain)
+ //self.possibleItemImage2.addGestureRecognizer(tapGesture2)
+ //self.possibleItemImage3.addGestureRecognizer(tapGesture)
+ //self.possibleItemImage4.addGestureRecognizer(tapGesture)
+ //self.possibleItemImage5.addGestureRecognizer(tapGesture)
+
}
+
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
@@ -118,6 +95,29 @@ class ItemImagePickerViewController: UIViewController {
self.isEditing = !self.isEditing
}
+
+
+
+ /*
+ This function is called in the viewDidLoad function.
+ It will load all these editable items into the scroll view
+ being used to control the text editing views
+ */
+ func addEditableItemsToScrollView(){
+ self.textEditScrollView.addSubview(self.itemName)
+ self.textEditScrollView.addSubview(self.itemDescription)
+ self.textEditScrollView.addSubview(self.itemQuantity)
+ self.textEditScrollView.addSubview(self.priceLabel)
+ self.textEditScrollView.addSubview(self.titleLabel)
+ self.textEditScrollView.addSubview(self.quantityLabel)
+ self.textEditScrollView.addSubview(self.descriptionLabel)
+ self.textEditScrollView.addSubview(self.itemPrice)
+ }
+
+
+
+
+
}
//MARK: - Navigation methods
@@ -128,7 +128,6 @@ extension ItemImagePickerViewController {
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
-
if(segue.identifier == "CategoriesSegue"){
print(self.itemName.text!)
print(self.itemDescription.text!)
@@ -361,8 +360,8 @@ extension ItemImagePickerViewController: UITextViewDelegate {
textView.textColor = UIColor.blackColor()
//optional
}
- self.containerScrollView.setContentOffset(CGPointMake(0, 200), animated: true)
textView.becomeFirstResponder()
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 100), animated: true)
}
func textViewDidEndEditing(textView: UITextView) {
@@ -371,7 +370,16 @@ extension ItemImagePickerViewController: UITextViewDelegate {
textView.textColor = UIColor.lightGrayColor()
//optional
}
- textView.resignFirstResponder()
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 0), animated: true)
+ }
+
+ //Will check for the return key so it can dismiss the text view keyboard
+ func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool {
+ if text == "\n"{
+ textView.resignFirstResponder()
+ return true
+ }
+ return true
}
func textViewDidChange(textView: UITextView) {
@@ -398,13 +406,7 @@ extension ItemImagePickerViewController: UITextFieldDelegate {
self.view.endEditing(true)
}
- func textFieldDidBeginEditing(textField: UITextField) {
- self.containerScrollView.setContentOffset(CGPointMake(0, 200), animated: true)
- }
- func textFieldDidEndEditing(textField: UITextField) {
- self.containerScrollView.setContentOffset(CGPointMake(0, 0), animated: true)
- }
}
//Mark: - IBActions
@@ -525,3 +527,36 @@ extension ItemImagePickerViewController {
}
+
+//All these functions will handle the scrolling of the editable elements into view
+extension ItemImagePickerViewController{
+
+ /*
+ Each of these functions are event handlers on edit begin/end for
+ each of the editable elements in the view. This will scroll them into view.
+ To see which function controls what, check the function name
+ */
+ @IBAction func onTitleEditEnd(sender: AnyObject) {
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 0), animated: true)
+ }
+
+ @IBAction func onPriceEditEnd(sender: AnyObject) {
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 0), animated: true)
+ }
+ @IBAction func onPriceEditBegin(sender: AnyObject) {
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 50), animated: true)
+ }
+
+ @IBAction func onQuantityEditBegin(sender: AnyObject) {
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 50), animated: true)
+ }
+
+ @IBAction func onQuantityEditEnd(sender: AnyObject) {
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 0), animated: true)
+ }
+ //This will scroll the title into view when editing it
+ @IBAction func editingTitleBegan(sender: AnyObject) {
+ self.textEditScrollView.setContentOffset(CGPoint( x: 0, y: 0), animated: true)
+ }
+
+}
diff --git a/Vendoo/Main.storyboard b/Vendoo/Main.storyboard
index 69728fa..88d4ab6 100755
--- a/Vendoo/Main.storyboard
+++ b/Vendoo/Main.storyboard
@@ -362,6 +362,10 @@
+
+
+
+
@@ -369,6 +373,10 @@
+
+
+
+