代码之家  ›  专栏  ›  技术社区  ›  Mark

ContentInset在ScrollView中是如何工作的?

  •  0
  • Mark  · 技术社区  · 15 年前

    我知道Content Inset的作用,它会在UIScrollView中插入contentView。此时,似乎要将这些值添加到contentSize,这意味着我需要这样做:

        [__scrollView setContentInset:UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0)];
        [__scrollView setContentSize:CGSizeMake(__scrollView.frame.size.width - __scrollView.contentInset.left - __scrollView.contentInset.right, 0.0)];
    

    但问题是,在我使用contentInset之后,我再也看不到滚动指示器了?有人熟悉这个吗?

    1 回复  |  直到 15 年前
        1
  •  0
  •   Robert Höglund    15 年前

    contentSize UIScrollView 小于滚动视图本身的大小。只有 内容大小