假设要设置UITextField的动画。
UITextField有一个起点为x-50,y-100的CGRect;
@implementation myViewController{
UITextField *myTextField; //Declaring a textfield as an instance variable (global).
}
-(void)viewDidLoad{
myTextField = [UITextField alloc]initWithFrame:CGRectMake(50,100,100,50)];//adding memory and setting its initial position
//your other codes.
}
-(void)screenswipeleft {
[UIView animateWithDuration:3 animations:^{
myTextField.frame = CGRectMake:(-75,100,100,50); //setting the same textfield in a position of -75 only showing 1/4th of the textfield.
//this block animation would make the textfield animate from its starting position to this position in 3 seconds. (animateWithDuration:3 here u mention its duration).
}];
}
将相同的逻辑应用于其他人,您将获得所需的动画。