I want to display grid of image in scrollview with paging.All images are from server . I know to use scrollview with paging.But how can we show images in scrollview with paging. Can i get idea for how to do this?
Better to use your own logic to arrange the images in scroll view
Create a UiScrollView with paging enabled.. to do this please refer this link
Create a for-loop with adjusting X and Y coordinates of your imageView
From the above link ,these two below method will help you to achieve the functionality
- (void)scrollViewDidScroll:(UIScrollView *)sender {
// Update the page when more than 50% of the previous/next page is visible
CGFloat pageWidth = self.scrollView.frame.size.width;
int page = floor((self.scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
self.pageControl.currentPage = page;
}
- (IBAction)changePage {
// update the scroll view to the appropriate page
CGRect frame;
frame.origin.x = self.scrollView.frame.size.width * self.pageControl.currentPage;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
[self.scrollView scrollRectToVisible:frame animated:YES];
}