Note that there are some explanatory texts on larger screens.

plurals
  1. PODismiss UIScrollView based on touch coordinates on UIImageView embedded into the UIScrollView
    primarykey
    data
    text
    <p>There is a <code>UITableView</code> with many photos. As a photo is tapped, a <code>modalView</code> is presented with <code>UIScrollView</code>, which further has an <code>UIImageView</code> embedded into it. The tapped image is presented here (similar to the Facebook app). Now, i can move the image vertically using <code>touchesMoved</code> and <code>CGRectMake</code>. What i want to achieve is that when i drag the image vertically, on reaching a certain threshold, the ImageView &amp; ScrollView should disappear and we should be back to the tableView.</p> <p>Image moved using:</p> <pre><code>- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch * touch = [touches anyObject]; CGPoint pos = [touch locationInView: [UIApplication sharedApplication].keyWindow]; NSLog(@"%f", pos.y); if (pos.y&gt;50&amp;&amp;pos.y&lt;430){ [UIView setAnimationDelay:0]; [UIView animateWithDuration:0.4 animations:^{_photoImageView.frame=CGRectMake(0,pos.y-100,320,200);} completion:^(BOOL finished){ }]; } } </code></pre> <p>The action to return control to the tableView is needed here:</p> <pre><code>- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch * touch = [touches anyObject]; CGPoint pos = [touch locationInView: [UIApplication sharedApplication].keyWindow]; if (pos.y&gt;50&amp;&amp;pos.y&lt;430){ [UIView setAnimationDelay:0]; [UIView animateWithDuration:0.4 animations:^{_photoImageView.frame=CGRectMake(0,140,320,200);} completion:^(BOOL finished){ }]; } else if(pos.y&lt;50||pos.y&gt;430) //Code needed here !! ; } </code></pre> <p>Further, if transparency can be achieved on the <code>imageView</code> background (i.e. Scrollview) such that the table view is visible with certain Alpha, that would be highly appreciated.</p>
    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.
 

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