缩小过渡以将UIView添加到超级视图 [英] curl down transition for adding an UIView to a superview

查看:47
本文介绍了缩小过渡以将UIView添加到超级视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在有时候事情并没有按预期工作.

now sometimes things just don't work as expected.

我的UIView有一种方法可以将自身添加到这样的给定父视图中

my UIView has a method to add itself to a given parent view like this

-(void)showPanelInView:(UIView*)view
{
 self.hidden = YES;
 [view addSubview:self];

 [UIView beginAnimations:@"categories_panel" context:NULL]; 
 [UIView setAnimationBeginsFromCurrentState:YES];
 [UIView setAnimationTransition: UIViewAnimationTransitionCurlDown forView:self cache:NO]; 

 [UIView setAnimationDuration:0.4];

 self.hidden = NO;

 [UIView commitAnimations];

}

但是它只是没有任何动画出现,将其自身从父级中移除的类似方法看起来还不错,无法让我的脑袋绕开……

but it just appears with no animation whatsoever, similar method to remove itself from the parent looks just fine, can't get my head around this one ...

有人看到问题出在哪里吗?

Anybody sees where's the problem?

我唯一能想到的是,当子视图被隐藏时,addSubview实际上并不会做很多事情……还是?

The only thing I can think about is that addSubview actually doesn't do much when the subview is hidden ... or?

推荐答案

[UIView setAnimationTransition:... forView:self cache:NO]; 

过渡应该应用于包含更改的不变视图,即

The transition should be applied to the unchanged view that contains the change, i.e.

[UIView setAnimationTransition:... forView:view cache:YES]; 

这篇关于缩小过渡以将UIView添加到超级视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆