我有一个从 UIViewController 派生的简单 ViewController,我在其中添加了一个枚举属性 swipeDirection。在代码中,我通常将其称为 self.swipeDirection,但在一个实例中,我注意到我错误地输入了 self.SwipeDirection。
如果我跳转到定义,我会得到正确的变量,并且代码可以正确编译和运行,所以我确信正在使用正确的变量。
.h 文件
enum EScrollDirection
{
E_SCROLL_DIRECTION_NONE = 0,
E_SCROLL_DIRECTION_LEFT,
E_SCROLL_DIRECTION_RIGHT,
E_SCROLL_DIRECTION_UP,
E_SCROLL_DIRECTION_DOWN
};
typedef enum EScrollDirection EScrollDirection;
@interface ProcessingViewController : UIViewController <UIScrollViewDelegate>
@property(nonatomic, assign)EScrollDirection swipeDirection;
@end
.m 文件
- (void)scrollViewDidScroll:(UIScrollView *)sender
{
CGPoint offset = self.graphScrollView.contentOffset;
self.SwipeDirection = [self getScrollDirection:self.previousTouchPoint endPoint:self.graphScrollView.contentOffset];
// ...
}