cell上添加 bin
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * cellID = @"cellID";
JWBespeakCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!cell) {
cell = [[JWBespeakCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
JWTylBespeakModel * bespeakModel = self.dataArray[indexPath.row];
cell.bespeakModel = bespeakModel;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
self.button = [UIButton buttonWithType:UIButtonTypeCustom];
self.button.center = CGPointMake(CGRectGetMaxX(cell.label.frame)+35, 35);
self.button.bounds = CGRectMake(0, 0, 40, 40);
[self.button setBackgroundImage:[UIImage imageNamed:@"绿色地图标题"] forState:UIControlStateNormal];
[self.button addTarget:self action:@selector(tap:event:) forControlEvents:UIControlEventTouchUpInside];
self.button.tag = indexPath.row;
[cell addSubview:self.button];
return cell;
}
//点击方法
-(void)tap:(id)sender event:(id)event
{
NSSet *touches =[event allTouches];
UITouch *touch =[touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:_tableView];
NSIndexPath *indexPath= [_tableView indexPathForRowAtPoint:currentTouchPosition];
JWTylBespeakModel * bespeakModel = self.dataArray[indexPath.row];
JWMapController * map = [[JWMapController alloc]init];
map.f1 = [bespeakModel.lng floatValue];
map.f2 = [bespeakModel.lat floatValue];
[self.navigationController pushViewController:map animated:YES];
}