iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
pysama
V2EX  ›  iDev

请教如何给 UIPageViewController 添加/删除子页面

  •  
  •   pysama · Apr 13, 2015 · 4457 views
    This topic created in 4226 days ago, the information mentioned may be changed or developed.
    背景:
    我想实现一个类似iOS内置的相片浏览器,有左右滑动翻页的功能。打算用UIPageViewController来实现,但如果图片过多,一次性把所有图片都加入到UIPageViewController的页面中,性能会很差,
    所以想动态的去添加/删除子页面,但不知道如何写。

    没有查到相关的文档,希望得到各位的指点。谢谢 !
    9 replies  •  2015-04-14 13:06:04 +08:00
    kukat
    kukat
    Apr 13, 2015❤️1
    1
    如果子页面元素类似,干嘛不用UICollectionView
    keithellis
    keithellis
    Apr 13, 2015❤️1
    2
    可以考虑用 UICollectionView 横向滚动,UICollectionViewCell 大小设置为 UIViewController view 大小。
    1q2w3e4r
    1q2w3e4r
    Apr 13, 2015❤️1
    3
    用setViewControllers初始化一个controller,实现
    - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
    和
    - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
    wezzard
    wezzard
    Apr 13, 2015❤️1
    4
    估計樓主是想要 iBooks 的 Page Curling 的效果
    pysama
    pysama
    OP
    Apr 13, 2015
    5
    谢谢大家的帮忙

    @wezzard 倒不是享用page curling效果,就是普通的swipe 翻页即可。

    @1q2w3e4r 我回头试试

    @kukat @keithellis 这个思路不错。多谢
    Elethom
    Elethom
    Apr 13, 2015 via iPhone❤️1
    6
    @pysama
    普通 swipe 翻頁 Nimbus 有一個庫,而且包含了圖片縮放的功能。
    pysama
    pysama
    OP
    Apr 14, 2015
    7
    @Elethom 感谢Elethom的建议哈。我是新手,先用熟原生的哈。
    Elethom
    Elethom
    Apr 14, 2015 via iPhone
    8
    @pysama
    只要滑動 feature 的話可以參考我的 PRSlideView 實現。
    pysama
    pysama
    OP
    Apr 14, 2015
    9
    @Elethom 好呢,我去看看源码
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1713 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 05:41 · PVG 13:41 · LAX 21:41 · JFK 00:41
    ♥ Do have faith in what you're doing.