添加子视图时显示动画
我想添加一个带有动画的子视图。我正在使用添加子视图,因此它不显示任何动画,因此我想在执行此操作时显示任何动画...我正在使用下面的代码:-
UIViewController *vControllerHome = [[viewTemp alloc] initWithNibName:@"viewTemp" bundle:nil];
vControllerHome.view.frame =CGRectMake(0, 0, 320, 414);
[self.view addSubview:vControllerHome.view];
self.selectedViewController = vControllerHome;
任何人都可以建议我如何执行此操作吗?
I want to add a subview with animation. I am using add sub view so it is not showing any animation so I want to show any animation when I am doing this... I am using below code :-
UIViewController *vControllerHome = [[viewTemp alloc] initWithNibName:@"viewTemp" bundle:nil];
vControllerHome.view.frame =CGRectMake(0, 0, 320, 414);
[self.view addSubview:vControllerHome.view];
self.selectedViewController = vControllerHome;
Can any one suggest how I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是代码..试试吧。
PS:将
myView
替换为您要替换的视图的名称。Here's the code.. Just try it.
PS: Replace
myView
with the name of the view you want to replace.这是动画块
here is for animation blocks
也许您可以子类化 UIView 并重写方法
willMove(toSuperview newSuperview: UIView?)
这是示例:
Maybe you can subclass the UIView and override method
willMove(toSuperview newSuperview: UIView?)
Here is example: