我有一个问题scrollView。如您在图片中所见,滚动部分的结尾在下方约50像素navigationBar,但是,scrollView结尾部分恰好位于navBar
在iOS 11上,它可以按以下屏幕截图所示工作:
至于约束,这是它们的屏幕截图。
Superview是scrollView,ScrollView在主视图+顶部,底部,左侧和右侧的X和Y居中。
您知道可能是什么问题吗?任何帮助,不胜感激!
选择标签栏项时,我需要一直向上滚动表格视图.我试过这个,但它不起作用.
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)
}
}
Run Code Online (Sandbox Code Playgroud)
调用该方法但tableView不会滚动到顶部.