UIViewanimation改变button的大小

我开始尝试从应用程序商店重新创build购买button,需要2阶段点击才能购买。 我要animationbutton扩大。 到目前为止,我有这个

[UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.75]; sender.autoresizesSubviews = NO; sender.clipsToBounds = NO; sender.frame = CGRectMake(63,326,200,37); [UIView commitAnimations]; 

这只是使button变大,它根本不animation。 我做错了什么或有其他人实现了这种types的button行为?

编辑:

 - (IBAction) buyButtonAction: (UIButton *) sender { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.5]; [UIView setAnimationDelay:0.5]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; sender.clipsToBounds = NO; sender.frame = CGRectMake( CGRectGetMinX( sender.frame) - 30, CGRectGetMinY(sender.frame), 200, 37); [sender setTitle:@"Touched Touched Touched" forState:UIControlStateNormal]; [UIView commitAnimations]; } 

你的目标是不支持块的iOS吗?

我已经实现了一个“buttonanimation触摸”使用以下令人反胃的简单的代码。

 [UIView animateWithDuration:0.5 animations:^{ self.navigationItem.rightBarButtonItem.title = @"Quoting..."; }]; 

或者,如果你不支持块(如果你走这条路线,还包括注释掉的块),这段代码似乎也能工作:

 -(IBAction) clicked:(UIButton*)sender{ [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationDelay:0]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; //[UIView animateWithDuration:2.5 animations:^{ sender.autoresizesSubviews = NO; sender.clipsToBounds = NO; sender.frame = CGRectMake(63,326,200,37); //sender.frame = CGRectMake( CGRectGetMinX( self.theButton.frame) - 100, CGRectGetMinY(self.theButton.frame), 300, 40); //[sender setTitle:@"Touched Touched Touched" forState:UIControlStateNormal]; //}]; 
Interesting Posts