推动视图前的自定义分段控制(UIView)

时间:2017-05-09 00:29:41

标签: ios swift uiview collectionview

嗨我在点击了我的收藏View Cell时实现了自定义动画推送。我遇到的问题是当这个视图控制器向前推进时,我的自定义分段控制器仍然在它之上。这是我的推送代码:

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    let vc = PopUpCellViewController(nibName: "PopUpCellViewController", bundle: nil)
    let cell = collectionView.cellForItem(at: indexPath)
    sourceCell = cell
    self.navigationController?.pushViewController(vc, animated: true)

}

让我知道你是否可以帮我把这个Segmented控件放在我的“PopUpCellViewController”下面。

enter image description here

1 个答案:

答案 0 :(得分:1)

您可能正在将自定义分段控制器作为子视图添加到导航栏。永远不要这样做:您不能将任何子视图添加到导航栏。相反,将分段控制器作为视图控制器的navigationItem.titleView。然后它将占据导航栏的中心,但仅限于那个视图控制器(不是在推送之后)。