我有一个 View Controller ,其中的tableview包含聊天列表,导航项中嵌入了一个搜索 Controller (iOS 11功能)
let searchController = UISearchController(searchResultsController: nil)
searchController.dimsBackgroundDuringPresentation = false
navigationItem.searchController = searchController
definesPresentationContext = true
当用户在表格 View 中点击聊天时,应用会推送一个新的 View Controller ,该控件具有另一个包含该聊天消息的表格 View 。就像应该那样工作:
问题是,当用户激活搜索 Controller ,找到一些聊天并点击它时,包含带有聊天消息的表格 View 的插入式 View Controller 会对表格 View 进行一些非常奇怪的动画,而不应发生:
我在实际导航之前加载数据,并仅使用表 View 上的
viewDidLoad
将其绑定(bind)到reload()
中的表 View 。有问题的表 View 使用自动布局和自定义单元格。该问题与UITableView has unwanted animation when reloadData is called非常相似,但对我而言,仅在iOS 11搜索 Controller 处于 Activity 状态时才会发生。
编辑:如果我删除
tableView.rowHeight = UITableViewAutomaticDimension
并使用func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
使用固定高度,则问题仍然存在 最佳答案
就个人而言,在展示新的 View Controller 之前,我只是简单地隐藏了searchView Controller 。
(例如,将UIView.animates与完成处理程序一起使用)
我不会尝试进一步调查,因为自iOS11以来,安全区域管理中存在着深奥的问题。一个错误? :)
即使启动屏幕的布局也没有正确处理。
如此众多的专业徽标在发布时就错过了它们的中间部分!
关于ios - 从iOS 11搜索 Controller 导航时不需要的UITableView重新加载动画,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49177696/