views:

2846

answers:

2
+1  Q: 

UIScrollView

Hey guys. I'm creating a 30-35 page comic book and just have been hitting roadblock after roadblock in my journey.

1) I know that I have to create 30-35 different UIScrollviews with the images inside. The problem there is that the autorotation automatically throws half the image off the screen

2) i have no idea where to place this code Code:

UIScrollView* containerView = [[UIScrollView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; containerView.backgroundColor = [UIColor blackColor]; containerView.scrollEnabled = YES; containerView.pagingEnabled = YES; containerView.bounces = NO; containerView.directionalLockEnabled = YES;

self.view = containerView;

3) I'm thinking of paying a developer to just create this basic foundation and then explaining what he did so that i can add future images to the same foundation.

is there any place i can go to, to talk to someone over the phone or in person to work on coding this project. the deadline is soon and i'm just fustrated with the whole thing...

thanks

+1  A: 

try setting the autoresizingMask property on the view. For example:

UIViewAutoresizingFlexibleRightMargin The view resizes by expanding or shrinking in the direction of the right margin.

Available in iPhone OS 2.0 and later.

Declared in UIView.h.

The documentation under uiview will be helpful to you

ennuikiller
+2  A: 

Hey, it seems like you're stressed about this, but I honestly just went through a lot of these same hoops. Check out this awesome Apple Sample: Scrolling. That should help you out a lot.

A quick note about scrollviews: I don't quite understand what you mean by 30-35 UIScrollViews. That shouldn't be needed. In my app we have a UIViewController which has 1 UIScrollView inside. Then we just add photos to that and things work. The above sample should clear things up. [imageScrollView addSubview:imageView]; makes adding images to the scrollview simple.

If you set up your view structure in IB, things should work pretty smoothly.

About the half-paging issue an autorotation, it's a bug that I ran into and I spent a lot of time fixing it. I still don't know why it happens, but the solution is to create a layer of properties within your UIViewController that expose where the scrollview is at an time. You then just need to check against where you expect it to be and adjust when it's not the same. As always, lay out a complete layer for doing this, don't just fix it in one place.

I'm happy to post more if more is needed.

TahoeWolverine
maybe thats what i'm missing! The part where you say that i only need one UIscrollview and then i can just add the images inside. so how would i go about setting that up?I have it setup right now just like you said. My view controller and then right underneath it i have my UISCROlLVIEW. How do i begin to add these images so that i can scroll from one to another. IS there alot of coding involved? I really appreciate your time with this!
Dane
Do you have access to the scrolling example that I linked? It's not much coding at all and it's all in there. I'll post more when I get back to my mac.
TahoeWolverine
I do have the scrolling link example downloaded. IS there a line a code you would like me to refer to in that sample?
Dane