Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to restrict scrollViewWillBeginDragging to only one sender object?
    primarykey
    data
    text
    <p>i´ve built a nested scroll view. in the view.xib there is in the view one scrollview with vertical scrolling named rootScroll. in this one there are two other scrollviews with horizontal scrolling named topScroll and bottomScroll.</p> <p>my goal is to fade out bottomScroll when user drags the topScroll and fade it in again when decelerating ends. </p> <p>the code workes fine so far. the only problem is that scrollViewWillBeginDragging gets messages from all three UIScrollViews. i´ve logged the sender and can see that they´re different but anyway i don´t know how to restrict the animation only to messages sent by the topScroll!</p> <p>how can i distinguish different senders inside of scrollViewWillBeginDragging?</p> <p>probably an objective-c absolute beginners question. i hope someone will give me a hint anyway.</p> <p>thank you!</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // rootScroll [rootScroll setScrollEnabled:YES]; [rootScroll setContentSize:CGSizeMake(1024, 1980)]; // topScroll [topScroll setScrollEnabled:YES]; [topScroll setContentSize:CGSizeMake(3072, 406)]; // bottomScroll [bottomScroll setScrollEnabled:YES]; [bottomScroll setContentSize:CGSizeMake(3072, 188)]; } - (void)scrollViewWillBeginDragging:(UIScrollView *)sender { NSLog(@"will begin dragging, %i", sender); [UIScrollView beginAnimations:nil context:nil]; [UIScrollView setAnimationDuration:0.15f]; [self.bottomScroll setAlpha:0.0]; [UIScrollView commitAnimations]; } - (void)scrollViewDidEndDecelerating:(UIScrollView *)sender { NSLog(@"end position"); [UIScrollView beginAnimations:nil context:nil]; [UIScrollView setAnimationDuration:1.5f]; [self.bottomScroll setAlpha:1.0]; [UIScrollView commitAnimations]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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