2013-06-06 26 views
0

我有一个通用的应用程序,在键盘上我把这些控件。在iPhone版(纵向)中,一切正常,而iPad版(横向)则可见,但无法选择。我能怎么做?BSKeyboardControls不工作在版本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

回答

0

你必须检查是否在厦门国际银行给出UITextField设置代表。在这种情况下,您已经在iPhone UITextFiled中设置了委托,而未设置iPad的UITextFiled的委托,则inputAccessoryView不会看到文本字段。