ScrollView在其容器视图上不显示键盘

时间:2016-01-07 13:15:23

标签: ios objective-c uiscrollview uitextfield

我有一个Scrolleview,我有它的容器查看UIView和UIVew包含文本字段但是键盘没有弹出..

我使用过这种方法......

-(void)scrollViewAdaptForEditingtext:(UITextField*)textfield {        
    CGPoint point = CGPointMake(0, textfield.frame.origin.y - 1.5 * textfield.frame.size.height);    
    [self.scrollView setContentOffset:point animated:YES]; 
}

-(void)scrollViewEndEditingtext:(UITextField*)textfield {    
    CGPoint point = CGPointMake(0, 0);    
    [self.scrollView setContentOffset:point animated:YES];    
}

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {    
    [self scrollViewAdaptForEditingtext:textField];    
    return YES;    
}

#pragma TextFieldDelegateProtocol
-(BOOL)textFieldShouldReturn:(UITextField *)textField {    
    if (textField == self.txtFieldFirstName) {    
        [self.txtFieldLastName becomeFirstResponder];
    } else if (textField == self.txtFieldLastName) {          
        [self.txtFieldEmail becomeFirstResponder];
    } else if (textField == self.txtFieldEmail) {            
        [self.txtFieldMobNumber becomeFirstResponder];
    } else if (textField == self.txtFieldMobNumber) {            
        [self.txtFieldGender becomeFirstResponder];
    } else           
        [textField resignFirstResponder];

    [self scrollViewEndEditingtext:textField];
    return YES;
}

我可以包括uiview吗

0 个答案:

没有答案