如何在旋转木马中设置左视图和右视图之间的距离

时间:2016-06-22 10:05:22

标签: ios objective-c icarousel

有没有办法改变旋转木马中左视图和右视图之间的距离。

我尝试过设置视角,但它让我的视野很小。

2 个答案:

答案 0 :(得分:0)

我认为你需要遵循委托方法来改变距离。 委托要求iCarouselOptionSpacing的值返回合适的值..

- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
{
    switch (option)
    {
        case iCarouselOptionWrap:
        {
            return YES;
        }
        case iCarouselOptionSpacing:
        {
            //This is the spacing, return the value
            return 1.5f;
        }
        default:
        {
            return value;
        }
    }
}

答案 1 :(得分:0)

可见视图的数量仅取决于项目相对于屏幕的大小,间距和可见视图的数量。

<base href="https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="iron-icon/iron-icon.html">
<link rel="import" href="iron-icons/iron-icons.html">
<link rel="import" href="paper-button/paper-button.html">
<link rel="import" href="paper-dialog/paper-dialog.html">
<link rel="import" href="paper-checkbox/paper-checkbox.html">
<link rel="import" href="paper-tabs/paper-tabs.html">
<link rel="import" href="paper-toggle-button/paper-toggle-button.html">
<style is="custom-style">
  :root {
    --paper-tabs-selection-bar-color: var(--paper-light-blue-900);
    --paper-tab-ink: var(--paper-light-blue-100);
    --paper-tabs: {
      color: white;
      background-color: var(--paper-light-blue-500);
    };
  }
</style>

<body>
  <paper-button id="dialog-button" data-dialog="dialog">Dialog</paper-button>
  <paper-dialog id="dialog">
    <h2>Dialog Title</h2>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
  </paper-dialog>

    <script> 
        document.querySelector("#dialog-button").addEventListener("click", function(){document.querySelector("#dialog").open()});
    </script>
</body>