0

I am using UIScrollview and top of a UIView but scrolling is not working. for scrollview i added constraints all the side (0,0,0,0) then i have take container view and adedd constraints for (0,0,0,0) for all side . and one more constraints i added for this container view to View with equal width.

enter image description here

my scrollview hight is 504 and containner hight is 840. i am not getting any warning and suggestion constraints but not able to scroll . what is missing here .Please suggest me .

enter image description here

enter image description here

4 Answers4

2

if you have added constraints properly . then add this

make property or your scrolview and container view as

@property (weak, nonatomic) IBOutlet UIScrollView *scrollview;
@property (weak, nonatomic) IBOutlet UIView *containerview;

then in .m file

@synthesize scrollview,containerview,

then add this

-(void)viewDidAppear:(BOOL)animated
{
    [scrollview setContentSize:CGSizeMake(scrollview.frame.size.width, containerview.frame.size.height)];
}

I hope the will solve your issue.

Sport
  • 8,570
  • 6
  • 46
  • 65
1

There is no problem with autolayout in x-code 6.4 just try to check that you have properly bind the outlets of scrollview as well as give contentsize to scrollview that how much you would like to scroll your scrollview.

scrollview.ContentSize = CGContentSize(0, height);

--> Give height as float or integer as how much you want to scroll your scrollview.

Jecky
  • 476
  • 1
  • 4
  • 21
0

For the ScrollView to work, reference it to your .h file by CTRL + Dragging the scroll view, and on your .m file add a

scrollView.contentSize(0,doubleTheSizeOfTheViewHeight);

if you want the scroll to be scrollable horizontally do the same with the width.

Hope this helps

Update Or you can always use this for the storyboard way of doing it: Storyboard UIScrollView contentSize?

Community
  • 1
  • 1
cmario
  • 605
  • 1
  • 7
  • 22
0

To make UIScrollview scrolling, you have to uncheck checkbox with "Use Auto Layout" from XIB.

Megha Pawar
  • 115
  • 1
  • 5