Reputation: 73
I am making the iPad app in which I want to show animation when I start click on beginEditing here is the my code.
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
NSLog(@"This is calling");
[self showAnimationPests];
}
-(void) showAnimationPests
{
[UIView animateWithDuration:0.5
animations:^{
subView.frame = CGRectMake(0,-200,1024,748);
}];
}
It shows Log this is calling but view does not move.
Upvotes: 0
Views: 294
Reputation: 20551
try with my bellow code
Example..
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
subView.frame = CGRectMake(0,-200,1024,748);
[UIView commitAnimations];
return YES;
}
and set to 0 like default in textFieldShouldReturn:
method like bellow..
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
subView.frame = CGRectMake(0,0,1024,748);
[UIView commitAnimations];
return YES;
}
Upvotes: 0
Reputation: 559
If it's an iphone app why is the size of it 1024x748
?
CGRectMake
takes points not pixels (if you are trying to make up for retina display). And those points for iPhone 5 are 320x568
and previous devices 320x480
.
Upvotes: 1