【发布时间】:2017-04-13 21:07:02
【问题描述】:
选择标签栏项目时,我需要一直向上滚动表格视图。 我试过了,但它不起作用。
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
let tabBarIndex = tabBarController.selectedIndex
if tabBarIndex == 0 {
let indexPath = NSIndexPath(row: 0, section: 0)
MyViewController().tableView.scrollToRow(at: indexPath as IndexPath, at: .top, animated: true)
}
}
方法被调用,但是tableView没有滚动到顶部。
【问题讨论】:
标签: ios swift uitableview tableview