I have a table in the 1st interface controller , when a press on a row , a modal interface controller opens up , it contains a button.
I want the button to delete the row in the first interface controller.
Here is my code :
In the first interface controller
Blockquote
// It opens up a modal view ( with the context of the tapped row )
override func contextForSegueWithIdentifier(segueIdentifier: String, inTable table: WKInterfaceTable, rowIndex: Int) -> AnyObject? {
var timelineRow = timeline.reverse()
return timelineRow[rowIndex]
}
Blockquote
And here is my code in the second interface controller
Blockquote
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
sentContext = (context as? Dictionary)!
sentRow = sentContext
//sentRow contains the context
}
@IBAction func deleteRow() {
var sentRow : [String:String] = ["action":"delete"]
NSNotificationCenter.defaultCenter().postNotificationName("notification_DeleteRow", object: nil, userInfo: sentRow)
dismissController()
}
Blockquote
I've sent the index of the row through the contextForSegueWithIdentifier.
In the 2nd Interface Controller I've extracted the Context and put it in variable
I then send back the userInfo throught the NSNotificationCenter
My Problem :
How can I use the userInfo sent back from the modal controller in order to delete the tapped row.
How would I manage to delete the tapped row (1st IC) by pressing on the delete button situated in the (2nd IC)