我有一个小问题,我尝试以这种方式显示带有动画的视图:
self.vistaAiuti = [[UIView alloc] initWithFrame:CGRectMake(10, -200, 300, 200)];
self.vistaAiuti.backgroundColor = [UIColor blueColor];
UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
closeButton.frame = CGRectMake(50, 140, 220, 40);
[closeButton setTitle:@"Go back" forState:UIControlStateNormal];
[closeButton addTarget:self action:@selector(closeView:) forControlEvents:UIControlEventTouchUpInside];
[self.vistaAiuti addSubview:closeButton];
[self.view addSubview:self.vistaAiuti];
[UIView beginAnimations:@"MoveView" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.5f];
self.vistaAiuti.frame = CGRectMake(10, 0, 300, 200);
[UIView commitAnimations];
这关闭它:
[UIView beginAnimations:@"MoveView" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.5f];
self.vistaAiuti.frame = CGRectMake(10, -200, 300, 0);
[UIView commitAnimations];
问题是 vista aiuto 上的按钮比 vistaAiuti 慢,所以当我关闭视图时,按钮会在后面停留一秒钟......我必须做些什么才能获得相同的速度?