UIButton * bgBtn = [[UIButton alloc] initWithFrame:cell.mealImageView.frame];
[cell addSubview:bgBtn];
[bgBtn addTarget:self action:@selector(mealImageSingleTap: event:) forControlEvents:UIControlEventTouchUpInside];
-(void)mealImageSingleTap:(id)sender event:(id)event {
if( event == nil) return ;
NSSet *touches = [event allTouches];
if( touches == nil ) return ;
UITouch *touch = [touches anyObject];
if( touch == nil ) return ;
CGPoint currentTouchPosition = [touch locationInView:self.myTableView];
NSIndexPath *indexPath = [self.myTableView indexPathForRowAtPoint: currentTouchPosition];
NSInteger index = indexPath.row;
NSInteger section = indexPath.section;
NSString * keyStr = [[self.dataDic allKeys] objectAtIndex:section];
NSArray * mealArr = [self.dataDic objectForKey:keyStr];
VASMealInfo * mealInf = [mealArr objectAtIndex:index];
}
网友评论