【问题标题】:UIStoryBoard und UIPageViewController and initWithTransitionStyleUIStoryBoard 和 UIPageViewController 和 initWithTransitionStyle
【发布时间】:2011-11-13 17:55:58
【问题描述】:

我对如何使用故事板和自定义首字母感到困惑。

我需要在 UIPageViewController 上调用 initWithTransitionStyle。

但是如果故事板为我创建了 UIPageViewController,该怎么做呢?

通过调试,我可以看到在我的 UIPageViewController 上调用了 initWithCoder。

【问题讨论】:

  • 请停止在标题中写标签。

标签: ios uiviewcontroller uipageviewcontroller


【解决方案1】:

根据文档,只有一种过渡样式:

过渡样式

翻页过渡的样式。

enum {
    UIPageViewControllerTransitionStylePageCurl = 0
};
typedef NSInteger UIPageViewControllerTransitionStyle;

常量

UIPageViewControllerTransitionStylePageCurl

页面卷曲过渡样式。 指定页面卷曲过渡样式时,页面视图控制器在视图控制器之间转换时会显示翻页动画。如果指定了数据源,则动画会在导航手势期间跟随用户的手指。 在 iOS 5.0 及更高版本中可用。 在 UIPageViewController.h 中声明。

当他们介绍其他人时,我希望您能够在界面生成器中定义他们。

【讨论】:

    【解决方案2】:

    如果您正在使用情节提要(也就是将 UIPageViewController 放到情节提要上),它已经初始化,所以我不确定您为什么需要初始化它。

    如果您只想更改过渡样式、导航方向、页面间距等,这些都是“属性检查器”选项卡中的选项。

    【讨论】:

      【解决方案3】:
      SecondViewController* bvc = [[SecondViewController alloc] init];
      
      [UIView transitionWithView:self.view.window
                        duration:1.0f
                         options:UIViewAnimationOptionTransitionCurlUp
                      animations:^{
                          [self.navigationController pushViewController:bvc animated:NO];
                      }
                      completion:NULL];
      
      [self.navigationController pushViewController:bvc animated:YES];
      

      【讨论】:

        【解决方案4】:

        我找到了问题的解决方案: 在这里:在appdelegate.m 文件中

        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        {
        
            // Override point for customization after application launch.
             CountBookViewController *bc = [[CountBookViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
            [bc awakeFromNib];
        
            self.window.rootViewController = bc;
            [self.window makeKeyAndVisible];
            return YES;
        }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2015-08-08
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-08-26
          • 2012-05-29
          • 1970-01-01
          相关资源
          最近更新 更多