简体   繁体   English

对带有约束的UIView进行动画移除

[英]Animating the removal of a UIView with constraints

I have a vertical list of UIView s that are not in a UITableView or a UICollectionView or anything like that, they are simply views added to a UIScrollView positioned in rows using constraints (these views don't link to anything so I did not put them into a table view). 我有一个UIView的垂直列表,不在UITableViewUICollectionView或类似的东西中,它们只是添加到使用约束放置在行中的UIScrollView视图(这些视图没有链接到任何东西,因此我没有放置它们进入表格视图)。 If I wanted to remove one or more of these views upon a user action and I wanted that view to animate out while the views beneath it slid up to fill the void, is this the perfect time to use a UITableView ? 如果我想在用户操作时删除这些视图中的一个或多个,并且希望在该视图下的动画向上滑动以填充空白时对其进行动画处理,这是否是使用UITableView的最佳时机?

I was under the impression that the UITableView is really to be used for master/detail situations like lists that link to detail view controllers. 我的印象是, UITableView实际上用于主/详细情况,例如链接到详细视图控制器的列表。 Or is there a clean way of animating the adding and removal of these views using their constraints? 还是有一种干净的方法来使用它们的约束来动画化这些视图的添加和删除?

You can use Vertical Stack View. 您可以使用垂直堆栈视图。 It suitable for your requirement. 适合您的要求。 It adjust space automatically when one view is removed from list of views 从视图列表中删除一个视图时,它将自动调整空间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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