简体   繁体   English

iPhone SDK中子视图的动画

[英]Animations of Subviews in iphone sdk

haii i have 5 subviews in a viewcontroller,each subvies are shown when corresponding button are clicked.But normally when i button is clicked,it shows the subview without animating or tansistion .I need to give a effect for the subview when it popup. 我在一个视图控制器中有5个子视图,单击相应按钮时会显示每个子视图。但是通常,当单击i按钮时,它会显示该子视图而没有动画或剪切。我需要在弹出子视图时为其赋予效果。 i tried this but no luck 我尝试了这个但是没有运气

[UIView beginAnimations:@"page transition" context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:NoteView cache:YES];

    [self.view addSubview:NoteView];

in button click.is there any way to animate like this. 在click.click中有没有办法像这样制作动画。

You forgot to add commitAnimation method 您忘记添加commitAnimation方法

[UIView beginAnimations:@"page transition" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:NoteView cache:YES];

[self.view addSubview:NoteView];
[UIView commitAnimation];

you should be using blocks for animation, look at 您应该将块用于动画,看看

transitionFromView:toView:duration:options:completion:

in UIView, with UIViewAnimationOptionTransitionCurlUp as one of the option masks 在UIView中,使用UIViewAnimationOptionTransitionCurlUp作为选项掩码之一

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM