首页 > 代码库 > 将TableView的中的Label和Cell行数绑定

将TableView的中的Label和Cell行数绑定

    [cell.followBtn addTarget:self action:@selector(onFollowButtonsClickEvent:) forControlEvents:UIControlEventTouchUpInside];
    [cell.followBtn setTag:indexPath.row];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onUserClickEvent:)];
    cell.userHeadImageView.userInteractionEnabled = YES;
    cell.userHeadImageView.tag = indexPath.row;
    [cell.userHeadImageView addGestureRecognizer:tap];

 

 

#pragma mark Button event

- (void)onUserClickEvent:(id)sender{
    if ([sender isKindOfClass:[UITapGestureRecognizer class]]) {
        UIView *view = [(UITapGestureRecognizer*)sender view];
        NSInteger index = view.tag;
        if (index < self.followedDataArray.count) {
            ICUser *followedItem = (ICUser*)[self.followedDataArray objectAtIndex:index];
            [Go2PageUtility go2UserDetailController:self.navigationController withUserId:followedItem.userId];
        }
    }
    
}

 

将TableView的中的Label和Cell行数绑定