0

我有一个通用应用程序,我在键盘上放置了这些控件。在 iPhone 版本(纵向)中,一切正常,而 iPad 版本(横向)可见但不可选择。我能怎么做?

编码:

 NSArray *fields = [NSArray arrayWithObjects: self.textFiel1,
                       self.textField2,
                       self.textField3,
                       self.textField4,
                       self.textField5,
                       self.textField6,
                       nil ];

 [self setKeyboardControls:[[BSKeyboardControls alloc] initWithFields:fields]];
 [self.keyboardControls setDelegate:self];

 [self.textFiel1 becomeFirstResponder];


 #pragma mark Text Field Delegate

 - (void)textFieldDidBeginEditing:(UITextField *)textField
 {
     [self.scrollView scrollRectToVisible:textField.frame animated:YES];
     [self.keyboardControls setActiveField:textField];
 }

 - (void)keyboardControls:(BSKeyboardControls *)keyboardControls selectedField:
   (UIView *)field inDirection:(BSKeyboardControlsDirection)direction
 {

     UIView *view = keyboardControls.activeField.superview.superview;

     [self.scrollView scrollRectToVisible:view.frame animated:YES];
  }


 - (void)keyboardControlsDonePressed:(BSKeyboardControls *)keyboardControls
{
    [keyboardControls.activeField resignFirstResponder];
}

在代码中,我没有区分 iphone 和 ipad 认为它是相同的。对于控件的构造,我遵循了以下示例: https ://github.com/simonbs/BSKeyboardControls/tree/bdb2200829d5f2aa082b3eb93fda00de5abf14d5/Example/Example

4

1 回答 1

0

您必须检查 xib 中的 UITextField 是否设置了代表。在这种情况下,您在 iPhone UITextFiled 中设置了代表,而在 iPad 中未设置 UITextFiled 的代表,则 inputAccessoryView 看不到文本字段。

于 2013-06-06T12:58:33.970 回答