iphone app scroll view is horizontal but i want it vertical - how do i change this?
Posted
by Billy Jones
on Stack Overflow
See other posts from Stack Overflow
or by Billy Jones
Published on 2010-03-23T12:11:21Z
Indexed on
2010/03/23
12:13 UTC
Read the original article
Hit count: 602
Hi Folks,
Got this code for a viewscroller from the apple developers site.
@synthesize scrollView1, scrollView2;
const CGFloat kScrollObjHeight = 467.0; const CGFloat kScrollObjWidth = 320.0; const NSUInteger kNumImages = 6;
(void)layoutScrollImages { UIImageView *view = nil; NSArray *subviews = [scrollView1 subviews];
// reposition all image subviews in a horizontal serial fashion CGFloat curXLoc = 0; for (view in subviews) { if ([view isKindOfClass:[UIImageView class]] && view.tag > 0) { CGRect frame = view.frame; frame.origin = CGPointMake(curXLoc, 0); view.frame = frame;
curXLoc += (kScrollObjWidth); }
}
// set the content size so it can be scrollable [scrollView1 setContentSize:CGSizeMake((kNumImages * kScrollObjWidth), [scrollView1 bounds].size.height)]; }
it works brilliantly the images are rotated by pulling them left or right. but I want to pull the images up and down to change them.
Can anyone help me out with this? this part in the code looks as if it controls the direction but i'm not sure how to change it.
// reposition all image subviews in a horizontal serial fashion CGFloat curXLoc = 0; for (view in subviews) { if ([view isKindOfClass:[UIImageView class]] && view.tag > 0) { CGRect frame = view.frame; frame.origin = CGPointMake(curXLoc, 0); view.frame = frame;
curXLoc += (kScrollObjWidth);
}
}
Any help most appreciated, thanks!
Billy
© Stack Overflow or respective owner