加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – UIPageViewController:pageViewController:spi

发布时间:2020-12-16 10:46:02 所属栏目:百科 来源:网络整理
导读:我的spineLocationForInterfaceOrientation-method未被调用;因此,脊柱总是在左边,但我想把它放在中间……我做错了什么? if ([UIPageViewController class]) { self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageView
我的spineLocationForInterfaceOrientation-method未被调用;因此,脊柱总是在左边,但我想把它放在中间……我做错了什么?

if ([UIPageViewController class]) {
    self.pageViewController = [[UIPageViewController alloc]
        initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
        navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
    self.pageViewController.view.backgroundColor = [UIColor redColor];
    self.pageViewController.delegate = self;

    NotesPageController *notesPageController = [[NotesPageController alloc]
        initWithNibName:@"NotesPageController" bundle:nil];
    NSArray *pageViewControllers = [NSArray arrayWithObjects:notesPageController,nil];
    [self.pageViewController setViewControllers:pageViewControllers
        direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];

    self.pageViewController.dataSource = self;

    [self addChildViewController:self.pageViewController];

    [self.navigationController pushViewController:self.pageViewController animated:NO];
}

非常感谢!

解决方法

您是否尝试手动设置spine属性?

要设置脊椎位置,请将其中一个常量包装在NSNumber对象中,并将其设置为传递给initWithTransitionStyle:optionsOrientation:options:方法的选项字典中的UIPageViewControllerOptionSpineLocationKey键的值.

参考:http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读