// // ResultCell.m // Apex Mobile // // Created by Jack on 2018/2/14. // Copyright © 2018年 United Software Applications, Inc. All rights reserved. // #import "ResultCell.h" @interface ResultCell () @property (nonatomic,assign) BOOL handlingTouch; @end @implementation ResultCell { UIColor *_normalBGColor; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)touch:(NSSet *)touches { if (self.handlingTouch) { return; } UITouch *touch = [[touches allObjects] lastObject]; if (self.touchDelegate && [self.touchDelegate respondsToSelector:@selector(touchedCell:withForce:)]) { self.handlingTouch = YES; [self.touchDelegate touchedCell:self withForce:touch.force]; } } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // if (self.touchColor) { // _normalBGColor = self.backgroundColor; // self.backgroundColor = self.touchColor; // } [super touchesBegan:touches withEvent:event]; self.handlingTouch = NO; [self touch:touches]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches withEvent:event]; [self touch:touches]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { // self.backgroundColor = _normalBGColor; [super touchesEnded:touches withEvent:event]; [self touch:touches]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { // self.backgroundColor = _normalBGColor; [super touchesCancelled:touches withEvent:event]; [self touch:touches]; } @end