我想知道是否可以创建一个 UIButton 动画以使按钮在屏幕中快速滑动,在到达中心时减速,然后加速并在另一侧退出屏幕。该按钮不必按下,所以我使用:
userInteractionEnabled = NO;
这是我试图做的:
UIButton* buttonNumberCountTutorial = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[buttonNumberCountTutorial setTitle:@"2" forState:UIControlStateNormal];
[buttonNumberCountTutorial setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[buttonNumberCountTutorial.titleLabel setFont:[UIFont fontWithName:@"Zapfino" size:40]];
buttonNumberCountTutorial.frame = CGRectMake(-400, 430, 400, 400);
[buttonNumberCountTutorial setBackgroundImage:[UIImage imageNamed:@"socialize-navbar-bg.png"]forState:UIControlStateNormal];
[baseView addSubview:buttonNumberCountTutorial];
[UIView animateWithDuration:1.9f
animations:^{
buttonNumberCountTutorial.frame = CGRectMake(20, 430, 200, 200);
}
completion:^(BOOL finished){
[buttonNumberCountTutorial removeFromSuperview];
}];