Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing image to another viewController
    text
    copied!<p>Is it possible to push a viewcontroller from a subview? I have a subview of (thumbnail) images, horizontally scrolling. I want when pressed to push a view controller (of the large photos). Obviously this needs to be done from the main view in which the subview resides.</p> <p>I tried just allocating the large photo view controller and pushing it, but that went kaboom.</p> <p>my first view which have the scrolled image s follow</p> <pre><code>scrollView.h @property (strong, nonatomic) IBoutlet UIScrollView *scrollView @Property (strong, nonatomic) PageController *pageController; </code></pre> <p><code>scrollView.m</code></p> <pre><code>- (void)viewDidload{ // here my image array } </code></pre> <p>and for another viewcontroller my code as the follow</p> <p><code>secondView.h</code></p> <p><code>@Property (nonatomic, strong) IBoutlet UIImageView *ImageView;</code></p> <p><code>@property (nonatomic, strong) UIImage *selectedImage;</code></p> <p>secondView.m</p> <pre><code>-(voide)viewDidload { //use tap gesture cod } - (void)singleTapGestureCaptured:(UITapGestureRecognizer *)gesture{ CGPoint touchPoint = [gesture locationInView:&lt;yourScrollView&gt;]; NSUInteger touchedPage = floorf(touchPoint.x / &lt;yourScrollView&gt;.frame.size.width); if ([&lt;arrayOfImages&gt; count&gt;] &gt; 1) { touchedPage = touchedPage % ([&lt;arrayOfImages&gt; count] - 1); } // i don't know what's the code put here to push the image to the second view </code></pre> <p>so please anybody can advice; thanks alot</p>
 

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