objective-c - 隐藏动画模态 UIView?

标签 objective-c ios uitableview animation

我需要以模态方式呈现然后关闭 UITableView。它应该从顶部到按钮进行动画处理。但它不应该覆盖整个屏幕,它会从导航栏下方滑入并在到达标签栏之前停止。

所以我不能将 presentViewController:animated:completion: 用于它的 View Controller 。 我需要将其作为 View 层次结构的一部分进行操作。问题是,这个 TableView 不可见时应该放在哪里。我将从哪里制作动画?

最佳答案

您可以将 UITableView 放在 UIView 中并使用 animateWithDuration。例如(使用一些组成的维度):

[subMenuView setFrame:CGRectMake(5,-400, 310, 400)];

[UIView animateWithDuration:0.8f
                      delay:0.0f
                    options:UIViewAnimationOptionTransitionCurlDown
                 animations:^{
                     [subMenuView setFrame:CGRectMake(5,0,310,400)];
                 }
                 completion:^ (BOOL finished) 
                 {
                     if (finished) 
                     {
                         //animation has finished, you can do something here, even another nested animation
                     }
                 }];

如果你想再向上滑动它,做相反的事情......

关于objective-c - 隐藏动画模态 UIView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12709317/

相关文章:

ios - 为什么 UIView 的 alpha 设置小于 1.0 时,UIView 的所有 subview 都显示半透明?

iphone - fmodf 获取模数的问题

objective-c - 在这种情况下如何实现 UINavigationController?

objective-c - NSMutableDictionary 在初始化后为空

objective-c - 如何在应用程序运行时获取控制台读数?

objective-c - NSDateFormatter 与 RSS pubDate

ios - iOS 11 中的导航栏自定义 ImageView 问题

ios - nib 必须恰好包含一个顶级对象,该对象必须是 UITableViewHeaderFooterView 实例

iphone - UITableViewController 推送时没有导航栏

swift - 当 swift 中 tableView 单元格的高度扩展时更改标签文本