Question

I've just started working with XCode 5.1 and iOS 7.1.
Im having some problems with PartialViews containing a scrollview. I have this screen](![http://imgur.com/n5KHXgF). I marked in red the space the scrollview should occupy but its taking more space vertically and horizontally. The viewcontroller and view are defined in the storyboard as freeform of 500x500 and the scrollview is defined like:

scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, rowHeight*[lstMatches count])];
scroll.contentSize = CGSizeMake(self.view.frame.size.width, rowHeight*[lstMatches count]);
//.....more elements here, added as subviews of scrollview
[self.view addSubview:scroll];

The problem is the next:

1) The scrollview is wider than its container so I can't click over right buttons. I tried changing the width of the viewcontroller and view to 800 (max width is about 750), but i cant click them.

Thanks for your help

Était-ce utile?

La solution

try:

scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height])];
scroll.contentSize = CGSizeMake(5000, rowHeight*[lstMatches count]);
[self.view addSubview:scroll];

PS: Change the contentSize.width of 5000 to something that suits your needs

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top