Dancer
Dancer

Reputation: 17681

IOS - UIScrollView Refusing to scroll

I have built a large IOS app and whilst testing noticed that a uiScrollview within a static page has stopped scrolling - to explain the setup of the page - the structure is as follows -

enter image description here

the scrollview is connected to the header file as scwollMa (as in above doc).

it has the following properties in storyboard -

enter image description here

enter image description here

I have applied the following into the .m page -

- (void)viewDidLoad
{
    [super viewDidLoad];

    //Set Scroller
    [_scwollMa setScrollEnabled:YES];


    self.scwollMa.contentSize = CGSizeMake(320, 1100);

Yet it does nothing! no error either - big head scratcher! Any advice at all?

Upvotes: 1

Views: 75

Answers (2)

Vinod Jat
Vinod Jat

Reputation: 1374

contentSize.Height must be greater to actual.height: Change the following line of code to

 self.scwollMa.contentSize = CGSizeMake(320, 1500);

will work for you.

and in interface builder keep height which is visible inside your view.

enter image description here

Upvotes: 2

Bernhard Grabowski
Bernhard Grabowski

Reputation: 469

You have set the height of the scrollview at the same height as the content size. To scroll set the height of the scroll view to fit into the visible screen area (like self.view.frame.size.height). If the scroll view and the content view have the same height, there's nothing to scroll for.

Upvotes: 2

Related Questions