我有一个 UIViewController 名为MainViewController
. 它是框架:我还有一个名为 UIView 的 UIView SingleSearchView
,它是 MainViewController 的子视图。
我将它添加singleSearchView
到 MainViewController:
self.singleSearchView = [[SearchView alloc] initWithFrame:CGRectMake(0, -480, 320, 480)];
[self.view addSubview:singleSearchView];
当我尝试使用以下动画“切换”到singleSearchView
它时,它会阻止我与singleSearchView
[UIView beginAnimations:@"searchAnimation" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.singleSearchView cache:YES];
[self.view setFrame:CGRectMake(0, 480, 320, 480)];
[UIView commitAnimations];
我也尝试过这种方式:
[UIView animateWithDuration:1.5 delay:0
options:UIViewAnimationOptionAllowUserInteraction
animations:^{
[self.view setFrame:CGRectMake(0, 480, 320, 480)];
}
completion:nil];
谢谢