ios - Swift: UITextField resignFirstReponder() error -


this code, drives me crazy:

lazy var currentedit: uitextfield! = nil ...  func cancelclicked() {     self.navigationitem.rightbarbuttonitems = nil     let setupbutton = uibarbuttonitem(title: "bearbeiten", style: uibarbuttonitemstyle.plain, target: self, action: #selector(detailviewcontroller.toggleediting))     self.navigationitem.rightbarbuttonitem =  setupbutton     if !self.managedobjectcontext.haschanges && !self.textchanged { // self.textchanged false         self.toggleediting()         return ...  func toggleediting() {     if !self.isvalid {         return     }      if self.currentedit != nil {         self.currentedit.resignfirstresponder()  // error thrown here     } 

i error

2016-05-28 23:04:39.606 visitenkarten[3695:121134] * terminating app due uncaught exception 'nsrangeexception', reason: '* -[__nsarrayi objectatindex:]: index 1 beyond bounds [0 .. 0]'

i don´t know why! :-( means [__nsarrayi objectatindex:]: index 1 beyond bounds [0 .. 0]

this content of variables: enter image description here

do u have idea, can do/check?

must add more informations?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -