我知道这个问题是典型的,并且在论坛上被多次询问过,但我仍然无法解决我的问题,所以如果任何机构可以提供帮助那就太棒了:)
我正在用阿拉伯语创建一个书籍应用程序,我需要从右到左执行uipageviewcontroller的转换。这就是我所要说的。
还有一件事(如果我没有很好地解释我的自我)我有这个线程的确切需要:How to change UIPageViewController direction of paging curl animation但是我无法设法提出他们所说的解决方案,所以如果有人可以向我解释或给我一个链接,我可以知道如何做到这一点就足够了:)。
答案 0 :(得分:9)
可以这样做
将pageViewController的数据源代码从viewControllerBeforeViewController
交换为viewControllerAfterViewController
将UIPageViewControllerSpineLocationMin
更改为UIPageViewControllerSpineLocationMax
要检查这一点,请将基于页面的应用程序模板作为通用启动,并在ModelController.m
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
{
NSUInteger index = [self indexOfViewController:(DataViewController *)viewController];
if (index == NSNotFound) {
return nil;
}
index++;
if (index == [self.pageData count]) {
return nil;
}
return [self viewControllerAtIndex:index storyboard:viewController.storyboard];
}
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
NSUInteger index = [self indexOfViewController:(DataViewController *)viewController];
if ((index == 0) || (index == NSNotFound)) {
return nil;
}
index--;
return [self viewControllerAtIndex:index storyboard:viewController.storyboard];
}
并将UIPageViewControllerSpineLocationMin
更改为UIPageViewControllerSpineLocationMax
并在“RootViewController.m”中滑动(indexOfCurrentViewController%2 == 0)的条件
- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation
{
if (UIInterfaceOrientationIsPortrait(orientation) || ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)) {
UIViewController *currentViewController = [self.pageViewController.viewControllers objectAtIndex:0];
NSArray *viewControllers = [NSArray arrayWithObject:currentViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];
self.pageViewController.doubleSided = NO;
return UIPageViewControllerSpineLocationMax;
}
DataViewController *currentViewController = [self.pageViewController.viewControllers objectAtIndex:0];
NSArray *viewControllers = nil;
NSUInteger indexOfCurrentViewController = [self.modelController indexOfViewController:currentViewController];
if (indexOfCurrentViewController == 0 || indexOfCurrentViewController % 2 == 0) {
UIViewController *previousViewController = [self.modelController pageViewController:self.pageViewController viewControllerBeforeViewController:currentViewController];
viewControllers = [NSArray arrayWithObjects:previousViewController, currentViewController, nil];
} else {
UIViewController *nextViewController = [self.modelController pageViewController:self.pageViewController viewControllerAfterViewController:currentViewController];
viewControllers = [NSArray arrayWithObjects:currentViewController, nextViewController, nil];
}
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];
return UIPageViewControllerSpineLocationMid;
}
答案 1 :(得分:1)
你应该深入研究核心图形和核心动画。
这是关于翻页的好example
答案 2 :(得分:1)
Madev,您不想使用“基于页面的应用程序”模板吗?
只需启动一个新的xCode项目:
在iOS>下应用程序,查找基于页面的应用程序。点击OK,选择你的选项。您所要做的就是提供您的内容(通过“数据源”)。
现在这是一个复杂的部分......但这里有一些提示
http://www.techotopia.com/index.php/An_Example_iOS_5_iPhone_UIPageViewController_Application