【发布时间】:2014-11-13 13:00:04
【问题描述】:
我有一个自定义视图,上面有一个UIButton。我正在尝试制作一个简单的动画,其中按钮应在按下按钮后的一秒钟内缩小一半。
但是问题是按钮没有动画我已经检查了动作方法并且它正在被调用但按钮没有动画。
-(instancetype)initWithFrame:(CGRect)frame
{
if (self=[super initWithFrame:frame]) {
//Loading From Nib
NSArray* views = [[NSBundle mainBundle] loadNibNamed:@"SelectionMenu" owner:nil options:nil];
[self addSubview:views[0]];
}
return self;
}
- (IBAction)firstBtn:(id)sender {
//Disabling the other two buttons
self.upperBtn2.backgroundColor = [UIColor grayColor];
self.upperBtn3.backgroundColor = [UIColor grayColor];
[self.slider setHidden:NO];
[self.slider.layer setZPosition:9.0];
[self startAnimation];
self.upperBtn2.userInteractionEnabled = NO;
self.upperBtn3.userInteractionEnabled = NO;
}
-(void)startAnimation
{
[UIView animateWithDuration:1.0 animations:^{
[self.upperBtn1 setFrame:CGRectMake(10, 20, 100, 100)];
}];
}
这里有什么问题。
【问题讨论】:
-
firstBtn是否调用touchUpInside:?如果是这样,请将其重置为touchDown。
标签: ios objective-c uiview uibutton uiviewanimation