[英]UITableView animation doesn't work after adding a subview
Literally! 从字面上看! Can't understand why.
不明白为什么。 Here's my code guys:
这是我的代码专家:
_tableOne_cloned = [_tableOne mutableCopy];
[_tableOne_cloned setFrame:CGRectMake(-320.0f, [_tableOne frame].origin.y, [_tableOne frame].size.width, [_tableOne frame].size.height)];
[[self view] insertSubview:_tableOne belowSubview:_bottomActionBar];
[UIView animateWithDuration:2.5 animations:^{
[_tableOne setFrame:CGRectMake(-320.0f, [_tableOne frame].origin.y, [_tableOne frame].size.width, [_tableOne frame].size.height)];
}];
The thing is simple: I have an UITableView on my screen. 事情很简单:我的屏幕上有一个UITableView。 When I push a certain UIButton, the UITableView must disappear and another one will appear from the left.
当我按下某个UIButton时,UITableView必须消失,另外一个将从左侧出现。
But, this is not working. 但是,这不起作用。 If I delete the line where I'm adding the new table works perfectly.
如果删除添加新表的行,则效果很好。
NOTES: UITableView doesn't conform NSCopying protocol but I created an extension to support it. 注意:UITableView不符合NSCopying协议,但是我创建了扩展来支持它。
Any ideas? 有任何想法吗?
When you want to animate it from left 当您想从左侧进行动画处理时
[UIView animateWithDuration:2.5 animations:^{
[_tableOne setFrame:CGRectMake(-320.0f, [_tableOne frame].origin.y, [_tableOne frame].size.width, [_tableOne frame].size.height)];
}completion:^(BOOL finished) {
[_tableOne setFrame:CGRectMake(+320.0f, [_tableOne frame].origin.y, [_tableOne frame].size.width, [_tableOne frame].size.height)];
[UIView animateWithDuration:2.5 animations:^{
[_tableOne setFrame:CGRectMake(0.0f, [_tableOne frame].origin.y, [_tableOne frame].size.width, [_tableOne frame].size.height)];
}];
}];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.