基本上我想弄清楚的是,如何编写以下内容:
//pseudo-code
if (the x value for contentOffset is equal to
a figure between, say, 50 and 100) {
then a specific void is to be executed.
}
谢谢!
答案 0 :(得分:1)
CGPoint offsetPoint = myScrollView.contentOffset;
float offset = sqrtf(powf(offsetPoint.x,2)+(powf(offsetPoint.y,2));
if (50 < offset && offset < 100) {
[self myMethod];
}
或者如果您只对一个方向感兴趣,请垂直说明,
CGFloat offset = myScrollView.contentOffset.y;