UIView removeFromSuperview

时间:2010-08-05 16:01:28

标签: iphone uiview uiviewanimationtransition

removeFromSuperview方法实际上非常快速地拉出图像,有没有办法以动画方式删除它。感谢

3 个答案:

答案 0 :(得分:7)

如果您的目标是iOS4(来自UIView文档的代码段):

[UIView animateWithDuration:0.2
                 animations:^{ table.alpha = 0.0; }
                 completion:^(BOOL finished){ [table removeFromSuperview]; }];

答案 1 :(得分:0)

答案 2 :(得分:0)

1)将新的子视图(索引为0,使其隐藏)插入视图堆栈。

    [window insertSubview:myNewView atIndex:0];

2)然后将视图(直接从文档中)动画为:

[UIView animateWithDuration:0.2
       animations:^{ view.alpha = 0.0; }
       completion:^(BOOL finished){ [view removeFromSuperview]; }]