键盘return键自定义
passwdInput.returnKeyType = .Next domainInput.returnKeyType = .Done //在willappear中获取事件 self.passwdInput.addTarget(self, action: "nextKey:", forControlEvents: .EditingDidEndOnExit) self.domainInput.addTarget(self, action: "nextKey:", forControlEvents: .EditingDidEndOnExit) //触发动作 func nextKey(sender: UITextField){ if(sender == self.nameInput){ self.passwdInput.becomeFirstResponder() }else if(sender == self.passwdInput){ self.domainInput.becomeFirstResponder() }else if(sender == self.domainInput){ login() } }
设置 Return key 类型,然后增加响应。