Tag: uipageviewcontroller

当用户点击行时,表格视图在导航栏下滑动

我有一个UINavigationController (NC)包含一个UITableViewController (TVC0)。 当用户点击一行时,它会加载一个UIPageViewController (PVC),它在其他UITableViewController (TVC1)之间来回切换。 TVC0显示在NC内部(意味着它不隐藏在顶部的导航栏或底部的标签栏后面)。 当它推动PVC时,第一个TVC1出现在导航栏和标签栏的边界内。 但是,当我滑动,里面的TVC1s隐藏在导航栏和标签栏后面。 我可以拉来揭示内容,但是当我释放时,它会回到酒吧后面。 我怎么能强迫一切出现在两个酒吧之间? 我不能使用故事板(因为它是一个传统的应用程序)和embedded…选项不可用。 [编辑] 我添加了一些日志logging,发现我的embedded式TVC1帧的绝对原点为0,64,但是一旦我点击,它就会变为0,0。如果我找不出一个真正的解决scheme,我总是可以伪造它通过加64,但我更想知道什么是错的。 [/编辑] [更多编辑] 我正在testingiOS 6模拟器的另一个区域,发现这个分页在iOS 6中完美无缺。所以我看到的问题是iOS 7的特定问题。 [/更多] 这里是我的TVC0 viewDidLoad ,PVC pageViewController:viewControllerBeforeViewController:和一个帮手viewControllerAtIndex: :: – (void) viewDidLoad { [super viewDidLoad]; NSDictionary* options = [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: UIPageViewControllerSpineLocationMin] forKey: UIPageViewControllerOptionSpineLocationKey]; self.pageController = [[UIPageViewController alloc] initWithTransitionStyle: UIPageViewControllerTransitionStyleScroll navigationOrientation: UIPageViewControllerNavigationOrientationHorizontal options: options]; self.pageController.dataSource = self; […]

意外的UIPageViewController行为

我目前正在使用UIPageViewController构build一个应用程序。 它正在按照我的预期工作,直到它到达包含数字UITextField的最后一页。 但是当我点击UITextField的一个实例时,它突然跳到上一页,没有任何理由而不是显示键盘。 当我滚动到最后一页并再次点击一个文本框时,它可以正常工作,没有任何问题。 当它通过点击链接到最后一页的导航button并且连接到UIPageViewController实例时立即显示最后一页也很好。 只有当我从第一页到最后一页滚动页面时,才会出现这个问题,而且在第一次尝试时只发生一次。 我怀疑内存不足问题,所以我在UIPageViewController实例和最后一个页面视图控制器的didReceiveMemoryWarning方法中设置了断点。 但他们从来没有被召唤。 第二个尝试是我在最后一个页面视图控制器的-willMoveToParentViewController:方法中添加了一个断点,并将其条件设置为parent == nil (当它从父视图控制器(这是所讨论的UIPageViewController实例)中移除时) 当我运行应用程序时,断点的调用堆栈表示该方法由UIPageViewController的-_flushViewController:animated:调用。 我不知道为什么这个-flushViewController:animated:被调用。 如果我能找出原因,这将帮助我解决问题。 有没有人可以帮助我?

如何在用户到达最后一页后向UIPageViewController添加新页面?

我有一个UIPageViewController ,它包含了通过networking获取的数据实例化的视图控制器。 当用户进行分页并且在最后几页之内时,我启动一个新的networking操作,并将得到的新视图控制器放到我的UIPageViewControllerDataSource的可变视图控制器数组的末尾。 一般来说,这一切运作良好。 但是,如果networking速度很慢(或者用户速度很快),那么在networking操作完成之前可能会到达最后一页。 由于pageViewController:viewControllerAfterViewController:当用户到达最后一页时被调用,它已经返回nil (“表示没有下一个视图控制器”)。 有没有一种很好的方式来强制UIPageViewController调用pageViewController:viewControllerAfterViewController: again(这样,当networking操作完成,现在有新的页面,我可以强制这个调用,使用户可以页面到新的页面)? 或者是有一种解决方法(可能阻止用户分页到最后一页,但仍显示反弹animation)?

如何在UIPageViewController中设置第一页

当用户在UIPageViewController的第一页上,并尝试返回时,我只返回nil。 在iOS 5中,这工作正常。 这是导致在iOS 6崩溃。 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The number of view controllers provided (0) doesn't match the number required (1) for the requested transition' 这是我的代码。 当返回contentViewController而不是nil ,它工作正常。 我应该把什么,而不是nil ? – (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController { contentViewController = [[ContentViewController_iPhone alloc] init]; int currentIndex = [self.modelArray indexOfObject:[(ContentViewController_iPhone *)viewController labelContents]]; […]

将PageCurl转换为使用UIPageViewController进行滚动

我想在视图之间改变我的animation。 目前我有PageCurl,但我想有像Snapchat一样的滚动animation。 我不能使用var transitionStyle: UIPageViewControllerTransitionStyle { get } 我的ViewController: import UIKit class ViewController: UIPageViewController, UIPageViewControllerDataSource{ let pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil) var messagesViewController : MessagesViewController! var searchViewController : SearchViewController! var friendsViewController : FriendsViewController! override func viewDidLoad() { super.viewDidLoad() // set UIPageViewControllerDataSource self.dataSource = self // Reference all of the view controllers on […]

在当前的应用程序添加UIPageViewController

我有一个应用程序在工作状态,其中我有三个屏幕1,2,3每个屏幕与UICollectionView关联,这是编程创build现在我想修改当前实现并将这些集合视图添加到UIPageViewControllers。 我试图用CollectionViewsfind许多与PageViewController有关的教程,但是无法find任何东西。 任何人都可以帮我实施这个或可以给我一个相关的参考。 我也提到了这个教程 ,但对我来说运气不佳:(

在一个pageViewController内部的tableView上滑动即可删除

我在pageViewController里面有一个tableView ,当在一个单元格上滑动以提供删除单元格的选项时,只有在某些情况下才会识别该手势,假设你非常迅速和积极地滑动。 我想这是因为它不确定滑动手势是为了pageView还是tableView 。 有没有一种方法可以明确确定滑动手势发生的位置,以便顺利显示删除button?

UIPageViewController / TextKit在分页上回stream文本

我正在使用TextKit支持的多页阅读应用程序,该应用程序基于WWDC 2013的“高级文本布局和与文本工具箱的效果”会话(但是其中一些代码是从不完整的示例中重新构build的)。 基本的结构是计算你的文本所需的页面数量,然后为每个页面创build一个NSTextContainer,并将其添加到NSLayoutManager。 每当UIPageViewController请求下一页或上一页时,您将创build一个新的UITextView,并通过从NLayoutManger的NSTextContainers数组中select正确的一个来设置其后备文本容器。 不幸的是,我有一个问题,在第一页,第一次,我回到任何给定的页面文本得到重新stream转。 这是它的样子: 这不是最明显的效果(如果你错过了,当回页时注意屏幕的顶部),但有点迷惑,我想尽可能消除它。 鉴于文本容器应该在前面计算,我不明白为什么它回stream的文本,或如何防止它。 有谁知道问题是什么? 编辑 :添加一个代码示例。 @interface ReaderViewController () <UIPageViewControllerDataSource> @property (nonatomic, assign) NSUInteger numberOfPages; @property (nonatomic, retain) UIPageViewController *pageViewController; @property (nonatomic, retain) NSTextStorage *currentDocument; @property (nonatomic, retain) NSLayoutManager *layoutManager; @end @implementation ReaderViewController – (instancetype)initWithDocument:(NSTextStorage *)document { if ((self = [super init])) { _currentDocument = document; } return self; } […]

iOS:UIPageViewController – 使用button跳转到下一页

我在PageViewController中有一系列的VC,用户通过手指从左到右浏览。 我需要添加button,实际上执行与手指滑动相同的动作,向左或向右移动一个VC。 我怎样才能做到这一点? 现在我正在使用这两种方法来dynamic设置用户滑动的VC: – (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController; – (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController; 如果用户点击一个button,我还可以做同样的事情吗?

在Swift中的PageViewController当前页面索引

我想获得一个pageViewController的当前索引,我不知道如何得到可见的页面索引。 func pageViewController(pageViewController: UIPageViewController, didFinishAnimating finished: Bool,previousViewControllers: [UIViewController],transitionCompleted completed: Bool) { // How to get it? }