I have a problem, when i put a text field in a simple view. The keyboard overlaps the view, how can i make than the keyboard push the view? I have to set an scrollview?
            Asked
            
        
        
            Active
            
        
            Viewed 1,096 times
        
    0
            
            
        - 
                    1possible duplicate of [How to make a UITextField move up when keyboard is present](http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present) – lihudi Aug 22 '14 at 12:16
1 Answers
0
            
            
        use this, hopping that ur textview in a scrollview and tag of it is 99
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
   UIScrollView *MyscrollView = (UIScrollView *)[self.view viewWithTag:99];
   [UIView animateWithDuration:1.0f animations:^(void){
            [MyscrollView setContentOffset:CGPointMake(0, 40) animated:YES];
   }];
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
   [UIView animateWithDuration:1.0f animations:^(void){
       UIScrollView *MyscrollView = (UIScrollView *)[self.view viewWithTag:99];
       [MyscrollView setContentOffset:CGPointMake(0, 0) animated:YES];
    }];
    [textField resignFirstResponder];
}
 
    
    
        sbrsantanu
        
- 137
- 5
