0

I have app i want that when user enters any data then view should slide up. I am writing this code this code works fine in another app but not working in this app.I am following same way.

-(void)showAnimationBack{

    NSLog(@"Back Animation is Working");


    [UIView animateWithDuration:0.5 
                     animations:^{
                         self.subViewLand.frame = CGRectMake(0,-10,1024,768);


                     }];

}


-(void) showAnimationPests{


    NSLog(@" Animation is Working");


    [UIView animateWithDuration:0.5 
                     animations:^{
                         self.subViewLand.frame = CGRectMake(0,-200,1024,768);


                     }];


}
DD_
  • 7,230
  • 11
  • 38
  • 59
Developer IOS
  • 115
  • 1
  • 2
  • 11

3 Answers3

1
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    self.subViewLand.frame  = CGRectMake(0,-200,1024,768); // or to self.view.frame  = CGRectMake(0,-200,1024,768);
    [UIView commitAnimations];
}

- (void)textFieldDidEndEditing:(UITextField *)textField{
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        self.subViewLand.frame = CGRectMake(0,-200,1024,768); // or to self.view.frame  = CGRectMake(0,-200,1024,768);
        [UIView commitAnimations];
} 

This code will work

Cintu
  • 913
  • 2
  • 16
  • 32
0

in textfielddidBeginEditing Method set view frame like this

 - (void)textFieldDidBeginEditing:(UITextField *)textField
{
   [self.subViewLand setFrame:CGRectMake(0, -200, 320, 480)];
}

in textfielddidEndEditing Method set view frame as it is.

- (void)textFieldDidEndEditing:(UITextField *)textField{
    [self.subViewLand setFrame:CGRectMake(0, 0, 320, 480)];
} 

It will definitely work. :)

Shah Paneri
  • 729
  • 7
  • 28
0

In textFieldDidBeginEditing() call the your method showAnimationPests() and similarly in textFieldDidEndEditing() call showAnimationBack() .

This will work fine for you.

Bhanu Prakash
  • 1,493
  • 8
  • 20