相关疑难解决方法(0)

翻转查看Iphone

请考虑下面的代码,并告诉我我做错了什么.

我想在两个UIViews之间翻转.

不知何故,当我从初始视图中移开时,我只是得到翻转的视图,没有动画.当我回头时,动画显示就好了.

翻转是从视图本身的按钮触发的.

- (IBAction)showMoreInfo:(id)sender
{
    UIView *moreInfo = self.flipView;

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationBeginsFromCurrentState:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];

    UIView *parent = self.view.superview;
    [self.view removeFromSuperview];

    [parent addSubview:moreInfo];

    [UIView commitAnimations];

}



- (IBAction)showLessInfo:(id)sender
{
    UIView *lessInfo = self.view;

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationBeginsFromCurrentState:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.flipView cache:YES];

    UIView *parent = self.flipView.superview;
    [self.flipView removeFromSuperview];

    [parent addSubview:lessInfo];

    [UIView commitAnimations];

}
Run Code Online (Sandbox Code Playgroud)

iphone flip

15
推荐指数
2
解决办法
3万
查看次数

标签 统计

flip ×1

iphone ×1