Quantcast
Channel: C++博客-天使的白骨-随笔分类-C++ lisp perl ruby python
Viewing all articles
Browse latest Browse all 15

UIPageViewController第一页不能自动适应子View的Frame的问题。

$
0
0
这个问题困扰了我两天,以为无解了,看了一天的英文资料,最后发现这是apple的BUG!shit
解决方案是这样:连续调用setViewController两次。
__weak UIPageViewController* pvcw = pvc;
[pvc setViewControllers:@[page]
    direction:UIPageViewControllerNavigationDirectionForward
    animated:YES completion:^(BOOL finished) {
        UIPageViewController* pvcs = pvcw;
        if (!pvcs) return;
        dispatch_async(dispatch_get_main_queue(), ^{
            [pvcs setViewControllers:@[page]
                direction:UIPageViewControllerNavigationDirectionForward
                animated:NO completion:nil];
        });
    }];
对于苹果的这种BUG,我只能表示蛋疼!如果你要学习UIPageViewController,在xcode中新建一个page Based工程就是了。
参考资料:iOSBook-chpter19


何清龙 2014-09-26 14:45 发表评论

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>