Why is UIScrollView leaving space on top and does not scroll to the bottom

后端 未结 13 2640
眼角桃花
眼角桃花 2020-12-01 09:15

I am new to objective-C programming.

I am using UIScrollView with some labels, image and text view on it.

I have turned off Autolayout and already tried wit

相关标签:
13条回答
  • 2020-12-01 09:50

    After user interface orientation going to landscape, my UIScrollView shown its UIScrollIndicator being misplaced. To fix this, you need to add the following code.

    As per iOS 13, yet supporting iOS 12 and earlier:

        // Fixes the scroll indicator misplacement when rotated in landscape
        if #available(iOS 13.0, *) {
            v.automaticallyAdjustsScrollIndicatorInsets = false
        } else {
            // Fallback on earlier versions
            v.contentInsetAdjustmentBehavior = .never
        }
    
        v.contentInset = .zero
        v.scrollIndicatorInsets = .zero
    
    0 讨论(0)
  • 2020-12-01 09:54

    Swift 3.0

    self.automaticallyAdjustsScrollViewInsets = false
    
    scrollView.contentInset = UIEdgeInsets.zero
    
    scrollView.scrollIndicatorInsets = UIEdgeInsets.zero;     
    
    0 讨论(0)
  • 2020-12-01 09:56

    Just select your view controller and set shown option to false (uncheck)

    ViewController Inspector

    0 讨论(0)
  • 2020-12-01 09:56

    iOS 11

    In my case only changing this UIScrollView Content Insets property in IB from Automatic to Never helped.

    0 讨论(0)
  • 2020-12-01 10:02

    Swift 3.0

    self.automaticallyAdjustsScrollViewInsets = false
    
    scrollView.contentInset = UIEdgeInsets.zero
    
    scrollView.scrollIndicatorInsets = UIEdgeInsets.zero;    
    
    scrollView.contentOffset = CGPoint(x: 0.0, y: 0.0);
    
    0 讨论(0)
  • 2020-12-01 10:02

    Swift 3 (Auto Layout)

    1. Change "Layout Margins" to explicit
    2. Set margins to your needs

    0 讨论(0)
提交回复
热议问题