2021-01-08 11:01

Forward UITextfield Delegate

I have added an optional delegate to QEntryTableViewCell called "ForwardedUITextFieldDelegate" this enhancement will allow controllers other than QEntryTableViewCell to respond to UITextfield delegate methods. An example where this may prove useful is performing an action when the "Done" button on they keyboard is clicked. In the sample the LoginController could respond to the delegate method

- (void)textField:(UITextField *)textField shouldReturn:(QEntryElement *)element {
    if([element.key isEqualToString:@"password"]) {
        [self onSignIn:element];

the textField parameter might prove to be irrelevant with the addition of the QEntryElement as a parameter, but I was trying to keep this delegate somewhat close to the UITextfield delegate. I added a forward delegate method for each of the delegate methods that are being used by QEntryTableViewCell, there are a few additional delegate that could be added but these might not be relevant in the context of QuickDialog.


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享