I have two horizontally scrolling UIScrollViews arranged vertically one above the other within the same ViewController. Each UIScrollView occupies half the screen. I am trying to track the position of both UIScrollViews myself.
I have successfully used this to track the position of the top UIScrollView:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView1 {
int Position = (scrollView1.contentOffset.x);
if (Position == 0) {
NSLog(@"Play A");
}
else if (Position == 280) {
NSLog(@"Play B");
}
}
I would also like to track the position of the bottom UIScrollView.
When I try to use this:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView2 {
int Position2 = (scrollView2.contentOffset.x);
if (Position2 == 0) {
NSLog(@"Play A2");
}
else if (Position == 280) {
NSLog(@"Play B2");
}
}
I am getting the error "FirstViewConroller scrollViewDidScroll scroll override".
So, having decided to click, I tried a rather hacky solution and tried to use it instead:
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView2
{
int Position2 = (scrollView2.contentOffset.x);
if (Position2 == 0) {
NSLog(@"Play A2");
}
else if (Position2 == 280) {
NSLog(@"Play B2");
}
}
, UIScrollViews . , UIScrollView 280 ( ) , , :
PlayB2
UIScrollView , :
PlayC
PlayC2
.
, , . viewDidLoad :
scrollView1.delegate = self;
scrollView2.delegate = self;
, ? , , , scrollViews ? .
- UIScrollView UIScrollView , , - , , .
. , , . . , , -, .