Why does my -scrollViewWillBeginDragging method of my UIScrollView delegate return such a strange contentOffset value?
-
06-07-2019 - |
Question
PROBLEM SOLVED! STUPID TYPO IN MY CODE!
That's my method of my UIScrollView delegate:
- (void)scrollViewWillBeginDragging:(UIScrollView *)activeScrollView {
NSLog(@"contentOffset: %f", activeScrollView.contentOffset);
}
Output in console is like:
2009-05-06 23:04:45.731 Demo[4851:20b] contentOffset: 21080643979530096233938944.000000
for sure my contentOffset isn't so huge ;)
Solution
contentOffset returns a CGPoint struct, so you'd want to use activeScrollView.contentOffset.y
instead of trying to pass the entire struct into %f, which is the format specifier for doubles.
OTHER TIPS
Because contentOffset is a CGPoint.
use NSLog(@"ContenfOffset : %@", NSStringFromCGPoint(activeScrollView.contentOffset));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow