简体   繁体   中英

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. 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.

You forgot to add commitAnimation method

[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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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