我正试图进行1.) The Class.forName() SPI logic where you can inject the expected business logic on the fly.
2.) The Spring DI with interfaces and implementations using auto wiring
摇晃。我已经让Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MsgBox("enter word to search for")
TextBox1.Focus()
Exit Sub
End If
WebBrowser1.Hide()
保持按钮单击,但摇动动画无效。这就是我所拥有的:
UIAlertView
我尝试在alertView
中添加- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
self.direction = 1;
self.shakes = 0;
[self shake:aUIView];
}
}
-(void)shake:(UIAlertView *)theOneYouWannaShake
{
[UIView animateWithDuration:0.03 animations:^ {
theOneYouWannaShake.transform = CGAffineTransformMakeTranslation(5 * self.direction, 0);
}
completion:^(BOOL finished) {
if(self.shakes >= 10) {
theOneYouWannaShake.transform = CGAffineTransformIdentity;
return;
}
self.shakes++;
self.direction = self.direction * -1;
[self shake:theOneYouWannaShake];
}];
}
并获得输出。所以我的代码一定有问题,为什么NSLog
没有动摇。
答案 0 :(得分:3)
您可以在iOS中使用 UIKit Dynamics 制作动画效果。这是tutorial使用 UIKit Dynamics 进行UIAlertView
摇动动画。有关更多信息,您可以参考这个快速的 tutorial 。
答案 1 :(得分:0)
我创造了一种幻觉,让警报看起来像是在颤抖。如果您必须设置参数,直到警报视图(包括深色背景屏幕)应该抖动的程度。
由于您无法使用UIAlertView的帧进行更改,因此请转到CGTranformations。
UIAlertView *dialog = [[UIAlertView alloc] initWithTitle:@"Title"
message:@"Message:"
delegate:self cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Done", nil];
[dialog setAlertViewStyle:UIAlertViewStylePlainTextInput];
[dialog show];
UIView *dillusionView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[dillusionView setBackgroundColor:[UIColor blackColor]];
[self.view addSubview:dillusionView];
[UIView animateKeyframesWithDuration:1.0 delay:0.0 options:UIViewKeyframeAnimationOptionAutoreverse | UIViewKeyframeAnimationOptionRepeat animations:^{
[UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.5 animations:^{
dialog.window.transform = CGAffineTransformTranslate(dialog.transform, dialog.frame.origin.x - 10, dialog.frame.origin.y);
}];
[UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:0.5 animations:^{
dialog.window.transform = CGAffineTransformTranslate(dialog.transform, dialog.frame.origin.x + 10, dialog.frame.origin.y);
}];
} completion:nil];
我建议使用自定义创建的UIAlertView,也可以使用很少的开源库。