I have a problem with my swift application. I am trying to schedule a local notification and i am trying to add the repeat interval to the code. The user should select how oft the notification should appear with a segmented control. I cant figure out how to do that.
Here is my viewcontroller file.
import UIKit
class TodoSchedulingViewController: UIViewController {
@IBOutlet weak var titleField: UITextField!
@IBOutlet weak var deadlinePicker: UIDatePicker!
@IBOutlet weak var segmentedControl: UISegmentedControl!
@IBOutlet weak var textLabelrepeat: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
textLabelrepeat.text = "Ingen gentagelser"
}
@IBAction func savePressed(sender: UIButton) {
Here is the first fail
let todoItem = TodoItem(deadline: deadlinePicker.date, title: titleField.text!, gentag: segmentedControl.gentag , UUID: NSUUID().UUIDString)
TodoList.sharedInstance.addItem(todoItem) // schedule a local notification to persist this item
self.navigationController?.popToRootViewControllerAnimated(true) // return to list view
}
@IBAction func indexChanged(sender: UISegmentedControl) {
switch segmentedControl.selectedSegmentIndex {
case 0:
textLabelrepeat.text = "Ingen gentagelser"
Here is the second fail
gentag.string = "notification.repeatInterval"
case 1:
textLabelrepeat.text = "Gentages dagligt"
case 2:
textLabelrepeat.text = "Gentages ugentligt"
default:
break;
}
}
}
In this code. Xcode come with 2 errors:
- Value of type 'UISegmentedControl' has no member 'gentag'
- Use of unresolved indetifier 'gentag'
Best regards
Mikkel Steffensen
Aucun commentaire:
Enregistrer un commentaire