所以,我想显示一个方形框,当用户点击屏幕时,一个典型的焦点动画。这是我尝试过的:
-(void)showFocusAnimation:(CGPoint)location{
UIView *square = [[UIView alloc]initWithFrame:CGRectMake(location.x, location.y, 40, 40)];
square.alpha=1.0;
square.layer.borderColor = (__bridge CGColorRef)[UIColor colorWithRed:12.0/255.0 green:185.0/255.0 blue:249.0/255.0 alpha:1];
square.layer.borderWidth = 2.0;
[overlayView addSubview:square];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.1];
square.frame = CGRectMake(location.x, location.y, 90, 90);
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.1];
square.frame = CGRectMake(location.x, location.y, 40, 40);
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.2];
square.frame = CGRectMake(location.x, location.y, 90, 90);
square.alpha = 0;
[UIView commitAnimations];
}
我有几个我似乎无法解决的问题:
我无法显示我的边框。
目前我正在从用户点击屏幕的点开始绘制一个正方形。用户点击它的点实际上应该是正方形的中心。
我似乎无法让动画正确。我想要做的是,减小正方形大小,增加它,然后再减小它,然后
alpha = 0
.
我想如果我有 3 个不同的单独动画,也许它会起作用,但不起作用。