我已经设置了一个自己的类(自定义 UIView)。我将其中两个 customViews 添加到我的 UIView 作为子视图。所以现在问题出现了:我如何为子视图设置动画?
myCustomView *myCustomViewInstance = [[myCustomView alloc] initWithText:@"myText"]];
[self.viewContainer addSubview:myCustomViewInstance];
myCustomView *myCustomViewInstance2 = [[myCustomView alloc] initWithText:@"myText2"]];
[self.viewContainer addSubview:myCustomViewInstance2];
通常我会使用以下方法为 uiview 设置动画:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.5];
self.viewContainer = CGRectMake(20,20,320,460);
[UIView commitAnimations];
在这种情况下,这不起作用,因为我正在为视图而不是子视图设置动画。由于本地声明,我也无法直接访问子视图。有任何想法吗?
非常感谢!