0

我以编程方式添加了UITextView's 和一个类对象,在调用时它的某些部分发生了变化:

textViewShouldEndEditing(textView: UITextView)

我将用户的对象字段保存为批量保存,但问题是即使调用UITextView了函数,最后编辑的值也不会保存。textViewShouldEndEditing唯一的其他复杂情况是批量保存是通过确认消息的一部分UIAlertAction

澄清一下,即使所有函数都以正确的顺序调用,访问的类对象UIAlertAction似乎也已过期。我希望这很清楚。

var tmpGuest:VIG = VIG()

func textViewShouldEndEditing(textView: UITextView) -> Bool {
    let saveTxt:String = (textView.text == "--" ? "" : textView.text)
    //SET SOME tmpGuest VALUES HERE
    return true
}

@IBAction func editInfo(sender: AnyObject) {
    let actionSheetController: UIAlertController = UIAlertController(title: "Are you sure you wish to save?", message: "Changes are permanent.", preferredStyle: .Alert)

    let okAction: UIAlertAction = UIAlertAction(title: "Yes", style: .Default) { action -> Void in
        //SAVE 
        self.setGuest.setRecords(guestMainTmp: self.tmpGuest)
    }
    actionSheetController.addAction(okAction)

    self.presentViewController(actionSheetController, animated: true, completion: nil)        
}
4

0 回答 0