Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 大标题UINavigationBar未使用UITableView滚动折叠_Ios_Swift_Uinavigationcontroller - Fatal编程技术网

Ios 大标题UINavigationBar未使用UITableView滚动折叠

Ios 大标题UINavigationBar未使用UITableView滚动折叠,ios,swift,uinavigationcontroller,Ios,Swift,Uinavigationcontroller,我的视图控制器有一个很大的标题导航栏,当用户向下滚动时,它应该是动画和折叠的。但是,导航栏保持较大,并且从不向下设置动画。 下面是预期的结果(不是我的视图控制器),但是我的导航栏没有崩溃 这是我当前的视图设置。根据一些研究,我认为问题在于UITableView必须是动画的第一个子视图。我还没有找到解决这个问题的办法 override func viewDidLoad() { super.viewDidLoad() let bottomPadding: CGFloat = 12

我的视图控制器有一个很大的标题导航栏,当用户向下滚动时,它应该是动画和折叠的。但是,导航栏保持较大,并且从不向下设置动画。 下面是预期的结果(不是我的视图控制器),但是我的导航栏没有崩溃

这是我当前的视图设置。根据一些研究,我认为问题在于
UITableView
必须是动画的第一个子视图。我还没有找到解决这个问题的办法

override func viewDidLoad() {
    super.viewDidLoad()

    let bottomPadding: CGFloat = 12.5
    
    view.addSubview(tableView)
    tableView.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: view.bottomAnchor, right: view.rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 0)
    setupTableView()
    
    view.insertSubview(animationView, belowSubview: tableView)
    animationView.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: view.safeAreaLayoutGuide.bottomAnchor, right: view.rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: bottomPadding, paddingRight: 0, width: 0, height: 0)
    animationView.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner]
    animationView.layer.cornerRadius = bottomPadding*2
    animationView.clipsToBounds = true
    animationView.layer.masksToBounds = true
}

正如您所说,tableview必须是动画视图的第一个子视图。当您将下面的子视图插入到tableview时,这条规则被打破了。@Alihan是的,但我正在查看是否有办法解决这一问题。不幸的是,据我所知,没有办法做到这一点。因此,我添加了我的片段,它们位于tableview的导航栏下。