Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should simply use a UIScrollView with paging enabled. The following code should do the trick:</p> <pre><code>NSInteger numberOfImages = [self.graniteImages count]; CGRect bounds = self.scrollView.bounds; self.scrollView.contentSize = CGSizeMake(bounds.size.width * numberOfImages, bounds.size.height); scrollView.pagingEnabled = YES; CGFloat x = 0; for (NSMutableDictionary *dict in images) { UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[dict valueForKey:@"image"]]]; imageView.frame = CGRectMake(x, 0, bounds.size.width, bounds.size.height); [scrollView addSubview:imageView]; x += self.view.bounds.size.width; } </code></pre> <p>EDIT: This code would go in your detail view controller's ViewDidLoad method. Your detail view controller should also have a property index of type NSUInteger and a graniteImages property of type NSMutableArray* that you can set in your collection view controller's prepareForSegue method just like:</p> <pre><code>-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if( [segue.identifier isEqualToString:@"yourSegue"]){ ((DetailViewController*)segue.destinationViewController).graniteImages = self.graniteImages; ((DetailViewController*)segue.destinationViewController).index = self.tappedImageIndex; } } </code></pre> <p>and in your ViewDidLoad method you add:</p> <pre><code>[scrollView scrollRectToVisible:CGRectMake(bounds.size.width * self.index, 0, bounds.size.width, bounds.size.height) animated:NO]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload