Got a strange problem which I dont understand.
I set the content size to a CGSize I created called newSize. I am adding buttons in a row in the UIScrollView that goes outside of the frame of the scrollview and changing the content size to match the new width + 400 for insurance.
newSize.width = contentSizeWidth+400;
NSLog(@"newSize width: %f", newSize.width);
[_scrollViewOutlet addSubview:button];
[_scrollViewOutlet setContentSize:newSize];
NSLog(@"scrollviewOutlet Content Width: %f", _scrollViewOutlet.contentSize.width);
the NSLog prints out 768. scrolling is enabled in the scrollview in interface builder but I cannot scroll the scrollview? What could the problem be?
I resolved the issue. It was an autolayout tick box that needed unticking in the view.
This may help: add buttons before you provide contentSize.
Mayble the proble is that the width of the frame is equal to the width of the contentSize.