簡體   English   中英

如何為Page View Controller提供“垂直覆蓋”過渡樣式

[英]how to give Page View Controller a “Cover Vertical” transition style

使用Navigation View Controller,我可以給出“垂直覆蓋”過渡樣式的動畫。 但是,在使用Page View Controller復制該代碼時遇到了麻煩。 故事板上提供的唯一選項是“滾動”和“頁面卷曲”。 有辦法以編程方式執行此操作嗎?

它看起來有些棘手,但應該可以使用:

創建一個UIViewController,它將是一個容器控制器。 在需要的地方添加UIPageControl。 然后以編程方式將UINavigationViewController添加為容器的子項,並將其視圖添加到視圖層次結構中。 您可以使用主情節提要的InstantiateViewControllerWithIdentifier:,並且如果您使用的是AutoLayout,請不要忘記為其設置約束。 當用戶在UINavigationViewController中導航時,請在容器與UINavigationViewController或UINavigationViewController的parentViewController屬性之間使用委托來更改UIPageControl。

UIPageViewController最好只做一件事情。 大多數時候,我更喜歡使用自定義容器控制器而不是使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM