-(void)tapGestureAction:(UITapGestureRecognizer *)tapGesture
{
CGPoint point = [tapGesture locationInView:self];
if (self.delegate && [self.delegate respondsToSelector:@selector(marketHeaderViewDidClickedIndex:marketInfoModel:)]) {
JMSMarketsInfoModel *marketInfoModel = nil;
NSInteger index = -1;
if (CGRectContainsPoint(self.leftView.frame, point)) {
index = 0;
if (self.marketsInfoModels.count > 0) {
marketInfoModel = self.marketsInfoModels[0];
}
}else if (CGRectContainsPoint(self.middleView.frame, point)){
index = 1;
if (self.marketsInfoModels.count >= index+1) {
marketInfoModel = self.marketsInfoModels[1];
}
}else if(CGRectContainsPoint(self.rightView.frame, point)){
index = 2;
if (self.marketsInfoModels.count >= index + 1) {
marketInfoModel = self.marketsInfoModels[2];
}
}
if (index != -1) {
[self.delegate marketHeaderViewDidClickedIndex:index marketInfoModel:marketInfoModel];
}
}
}
UIGestureRecognizer转换成相应子view的点
最新推荐文章于 2019-07-13 15:02:54 发布
本文介绍了一个iOS应用中市场头部视图点击事件的具体处理逻辑,通过判断用户点击的位置来触发相应的委托方法,并传递点击索引及市场信息模型。
807

被折叠的 条评论
为什么被折叠?



