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]
do u have idea, can do/check?
must add more informations?
Comments
Post a Comment