标签: uipageviewcontroller

155
推荐指数
7
解决办法
10万
查看次数

如何禁用UIPageViewController的滑动手势?

在我的情况下,父UIViewController包含UIPageViewController哪个包含UINavigationController哪个包含UIViewController.我想向最后一个视图控制器添加滑动手势,但滑动处理就像它们属于页面视图控制器一样.我尝试以编程方式和通过xib执行此操作,但没有结果.

据我了解,在UIPageViewController处理手势之前我无法实现目标.如何解决这个问题?

uiviewcontroller uigesturerecognizer ios uipageviewcontroller

114
推荐指数
9
解决办法
7万
查看次数

UIPageViewController:返回当前可见视图

你怎么知道里面显示的当前页面/视图是UIPageViewController什么?

我已经覆盖了viewDidAppear我的子视图的方法,因此他们在viewDidAppear方法中向父视图发送了一个id .

但问题是:我无法可靠地将该id用作显示页面的id.因为如果用户转动页面但中途决定停止转动并将页面放回,viewDidAppear则已经被调用.(视图在卷曲页面后面可见).

也许我应该只在当前视图消失的情况下切换到新的id.但我想知道是否有更简单的方法来返回当前可见的视图?

iphone ios uipageviewcontroller

88
推荐指数
8
解决办法
8万
查看次数

子视图控制器中的topLayoutGuide

我有一个UIPageViewController半透明的状态栏和导航栏.topLayoutGuide正如预期的那样,它是64像素.

但是,UIPageViewController报告的子视图控制器为topLayoutGuide0像素,即使它们显示在状态栏和导航栏下.

这是预期的行为吗?如果是这样,在真实情况下定位子视图控制器视图的最佳方法是topLayoutGuide什么?

(缺少使用parentViewController.topLayoutGuide,我认为是黑客攻击)

uiviewcontroller ios uipageviewcontroller autolayout ios7

69
推荐指数
4
解决办法
3万
查看次数

如何使ScrollView中的TableView滚动自然地表现出来

我需要做这个有奇怪配置的应用程序.

如下图所示,主视图是UIScrollView.然后里面应该有一个UIPageView,而PageView的每个页面都应该有一个UITableView.

数字

到目前为止我已经完成了这一切.但我的问题是我希望滚动行为 自然.

接下来是我的意思自然.目前,当我滚动其中一个UITableViews时,它会滚动tableview(而不是scrollview).但我希望它滚动ScrollView,除非scrollview无法滚动导致它到达顶部或底部(在这种情况下,我希望它滚动tableview).

例如,假设我的滚动视图当前滚动到顶部.然后我把手指放在桌面视图(显示的当前页面)上并开始向下滚动.在这种情况下,我希望滚动视图滚动(没有tableview).如果我继续向下滚动我的滚动视图并且它到达底部,如果我从显示器上移开手指并将其放回tebleview并再次向下滚动,我希望我的tableview现在向下滚动,因为滚动视图到达底部并且它不是能够继续滚动.

你们对如何实现这种滚动有任何想法吗?

我真的迷失了.任何帮助将非常感激它:(

谢谢!

uitableview uiscrollview uikit uipageviewcontroller swift

66
推荐指数
5
解决办法
5万
查看次数

iOS 8 UIPageViewController在转换后应用约束

我的应用程序有一个多窗格教程样式视图,用户可以通过该视图了解该应用程序.这非常实现,如本教程中所述.在为iOS 7和8实现它之后,我正在比较它们的工作方式,并找到后者的问题 - 我在这里运行Xcode 6 GM.

似乎UIPageViewController在转换完成后呈现视图.我重写了委托方法,看看发生了什么:

- (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers
{
   NSLog(@"Frame size before: %@", NSStringFromCGRect([(UIViewController*)pendingViewControllers[0] view].frame));
}

- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed
{
   NSLog(@"Frame size after: %@", NSStringFromCGRect([(UIViewController*)previousViewControllers[0] view].frame));
}
Run Code Online (Sandbox Code Playgroud)

这是一个示例输出:

Frame size before: {{0, 0}, {600, 600}}
Frame size after: {{0, 0}, {320, 568}}
Run Code Online (Sandbox Code Playgroud)

这样表现如下:向左滑动以拉入下一个视图,并在新视图的底部注意32磅的空白区域.转换完成后,它会进入正确的布局.

这可能是iOS 8中的错误吗?在这一点上,我完全没猜到.

uipageviewcontroller autolayout xcode6 ios8

64
推荐指数
3
解决办法
1万
查看次数

UIPageViewController,如何正确跳转到特定页面而不会弄乱数据源指定的顺序?

我发现了一些关于如何UIPageViewController跳转到特定页面的问题,但我注意到跳跃的一个额外问题,没有任何答案似乎承认.

没有进入我的iOS应用程序的细节(类似于分页日历),这是我正在经历的.我声明了一个UIPageViewController,设置当前的视图控制器,并实现一个数据源.

// end of the init method
        pageViewController = [[UIPageViewController alloc] 
        initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
          navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
                        options:nil];
        pageViewController.dataSource = self;
        [self jumpToDay:0];
}

//...

- (void)jumpToDay:(NSInteger)day {
        UIViewController *controller = [self dequeuePreviousDayViewControllerWithDaysBack:day];
        [pageViewController setViewControllers:@[controller]
                                    direction:UIPageViewControllerNavigationDirectionForward
                                     animated:YES
                                   completion:nil];
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController {
        NSInteger days = ((THDayViewController *)viewController).daysAgo;
        return [self dequeuePreviousDayViewControllerWithDaysBack:days + 1];
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController {
        NSInteger days = ((THDayViewController *)viewController).daysAgo;
        return [self dequeuePreviousDayViewControllerWithDaysBack:days - 1];
}

- (UIViewController *)dequeuePreviousDayViewControllerWithDaysBack:(NSInteger)days { …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios uipageviewcontroller

62
推荐指数
4
解决办法
5万
查看次数

使用UINavigationController在UIPageViewController中下载内容

更新2

我一直在使用4英寸设备在iOS模拟器中运行和测试我的应用程序.如果我使用3.5英寸设备运行,标签不会跳转.在我的.xib中,在Simulated Metrics下,我将它设置为Retina 4英寸全屏.知道为什么我只在4英寸设备上看到这个问题吗?

更新1

在IB中,如果我在模拟指标中选择"导航栏",我的标签仍然会跳转.我可以在第一个屏幕上正确呈现标签的唯一方法是不将导航控制器设置为我的窗口的根视图控制器.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

我的窗口的rootViewController被设置为一个UINavigationController,其rootViewController嵌入了一个UIPageViewController.

当我的应用加载时,会显示初始视图,其内容会向下推一点,大小与导航栏大致相同.当我滚动pageViewController时,内容会跳转到它在nib中的位置,而pageViewController加载的所有其他viewControllers都可以.

带导航控制器的uipageviewcontroller

在我的appDelegate中:

self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[ContainerViewController new]];
Run Code Online (Sandbox Code Playgroud)

在ContainerViewController中:

- (void)viewDidLoad {

    [super viewDidLoad];

    self.pvc = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
                                               navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
                                                             options:nil];
    self.pvc.dataSource = self;
    self.pvc.delegate = self;
    DetailViewController *detail = [DetailViewController new];
    [self.pvc setViewControllers:@[detail]
                       direction:UIPageViewControllerNavigationDirectionForward
                        animated:false
                      completion:nil];

    [self addChildViewController:self.pvc];
    [self.view addSubview:self.pvc.view];
    [self.pvc didMoveToParentViewController:self];
}
Run Code Online (Sandbox Code Playgroud)

xcode objective-c uinavigationcontroller ios uipageviewcontroller

60
推荐指数
3
解决办法
2万
查看次数

如何将UIPageControl元素放在UIPageViewController中的滑动页面之上?

关于如何使用UIPageViewController实现应用程序的AppCoda教程,我想在页面顶部而不是底部使用自定义页面控制元素.

当我只是将页面控制元素放在将要显示的单个视图的顶部时,逻辑结果是控件元素滚动,页面视图远离屏幕.

如何将控制元素置于视图顶部以使页面视图全屏(如图像),以便用户可以在固定控件元素下看到视图?

我附上了一个示例屏幕截图 - 来自AppCoda和Path的信用:

在此输入图像描述

storyboard uipagecontrol ios uipageviewcontroller

59
推荐指数
3
解决办法
5万
查看次数

隐藏UIPageViewController中的点

我想做一件非常简单的事情.只需删除所有点,以及UIPageViewController底部的栏.

这是设置:我有一个自定义视图控制器,它有UIPageViewController*pageController我显示如下:

self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

self.pageController.dataSource = self;
[[self.pageController view] setFrame:[self.view bounds]];

BSItemPageViewController *initialViewController = [self viewControllerAtIndex:selectedIndex];

NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];

[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

[self addChildViewController:self.pageController];
[[self view] addSubview:[self.pageController view]];
[self.pageController didMoveToParentViewController:self];
Run Code Online (Sandbox Code Playgroud)

关于如何删除点的任何想法?

cocoa-touch uipagecontrol ios uipageviewcontroller ios7

55
推荐指数
2
解决办法
3万
查看次数