UIScrollView doesn't scroll after upgrading to iOS7 / xcode 5

后端 未结 9 1916
抹茶落季
抹茶落季 2020-12-03 03:42

I have an app which in xcode 4.5 and ios 6.1 worked perfectly fine when scrolling. However, after downloading xcode 5 and iOS 7 my scroll views does not work anymore.???

相关标签:
9条回答
  • 2020-12-03 03:44

    I didn't have a fixed height so I set the contentsize of the scrollview in code according to my label inside the scrollview

    CGSize scrollViewContentSize = CGSizeMake(320, myLabel.frame.size.height);
    [self.scrollView setContentSize:scrollViewContentSize];
    
    0 讨论(0)
  • 2020-12-03 03:46

    I just set "Vertical Space" to auto constant value. May be it help in some case.

    Click the "Vertical Space"

    and set it in Attributes inspector

    tick that Standard

    I hope it help. Thx.

    0 讨论(0)
  • 2020-12-03 03:52

    I'm not sure if this is going to work

    - (void) viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        [grillretterScroller setContentSize:CGSizeMake(self.view.bounds.size.width, 915)];
    }
    
    0 讨论(0)
  • 2020-12-03 03:54

    I had the same issue after developing an app for iOS8, then testing on iOS7 afterwards. Although I had tried setting certain options on the scroll view such as:

    [self.scrollView setScrollEnabled:YES];
    [self.scrollView setContentSize:CGSizeMake(self.view.frame.size.width, 700)];
    [self.scrollView setContentOffset:CGPointZero];
    

    The solution that worked for me was to go into the storyboard file, and ensure that you have constraints set for all views within the scroll view. The scroll view's content size is calculated by the constraints of each subview within the scroll view, so in my case, I had a UIView and UITableView. After setting constraints for UIView (top, leading, trailing, height), and UITableView (vertical spacing to UIView, leading, trailing, bottom), the scroll view calculated the content size and started to function.

    While turning off Auto Layout does work, it's not an ideal solution for everyone. Just play around with Storyboard and set constraints for all subviews in the scroll view, so that a vertical line of constraints are set, from the top of the scroll view to the bottom.

    0 讨论(0)
  • 2020-12-03 04:03

    I solved this by deselecting 'Use Autolayout' in the File Inspector pane of main view within the Scroll View.

    enter image description hereenter image description here

    If you want to keep 'Autolayout' enabled, try 'Editor -> Reslove Autolayout Issues -> Add Missing Constraints'. The key constraint appears to be 'Bottom Space to: Superview and in my case was -300, giving 300 scroll space on the botton of the view.

    0 讨论(0)
  • 2020-12-03 04:03

    As mentioned by user2394787:

    Select your view controller that has the scrollview then go to

    Editor -> Resolve AutoLayout Issues -> Add Missing Contraints in [your view controller].  
    

    This will make it work.

    I tried to vote up the above answer but do not have enough rep.

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