I want to display the images available in my database in a scroll view. Also I want to display 4 images in a row, and then 4 in the next row, etc. In fact, the scroll view will show only 2 lines, and after scrolling vertically, the user will be able to scroll through all the images in the database. Can someone suggest any suitable measures for this or provide a demo or code for this. Any help would be appreciated.
I use this code to get horizontal images. How can I do this vertically after 5 images in a row. My code: -
- (void)layoutScrollImages
{
UIImageView *view = nil;
NSArray *subviews = [scrollView1 subviews];
CGFloat curXLoc = 40;
for (view in subviews)
{
if(view)
{
CGRect frame = view.frame;
frame.origin = CGPointMake(curXLoc, 40);
view.frame = frame;
curXLoc += (kScrollObjWidth);
}
}
[scrollView1 setContentSize:CGSizeMake((20 * kScrollObjWidth),[scrollView1 bounds].size.height)];
}
And I saw that I created a scroll in the form: -
scrollView1 = [[UIScrollView alloc] initWithFrame:CGRectMake(25,48,630,180)];
[scrollView1 setBackgroundColor:[UIColor lightGrayColor]];
[scrollView1 setCanCancelContentTouches:NO];
scrollView1.scrollEnabled = YES;
scrollView1.pagingEnabled=YES;
scrollView1.showsVerticalScrollIndicator = YES;
[self.view addSubview:scrollView1];
Thanks Christy