UITableView中cell上按钮获取所选cell
2016-07-20 15:03
471 查看
PostCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PostCell"]; if (cell == nil) { cell = [[PostCell alloc]initWithFrame:rect_detail]; } cell.btn_select.tag = indexPath.row + 5000; [cell.btn_select addTarget:self action:@selector(selectYouhuiquan:) forControlEvents:UIControlEventTouchUpInside]; //选中、未选中状态 [cell.btn_select setImage:[UIImage imageNamed:@"购物车-未选中"] forState:UIControlStateNormal]; [cell.btn_select setImage:[UIImage imageNamed:@"购物车-勾选"] forState:UIControlStateSelected]; - (void)selectYouhuiquan:(UIButton *)button { NSInteger index = button.tag - 5000; // PostCell *cell_select = (PostCell *)[button superview]; // [cell_select.btn_select setImage:[UIImage imageNamed:@"购物车-勾选"] forState:UIControlStateNormal]; lastButton.selected = NO; button.selected = YES ; lastButton = button ; // NSIndexPath *indexPath=[NSIndexPath indexPathForRow:index inSection:2]; // PostCell *cell = [v_post.table_post cellForRowAtIndexPath:indexPath]; // [cell.btn_select setImage:[UIImage imageNamed:@"购物车-未选中"] forState:UIControlStateNormal]; }
相关文章推荐
- EasyUI之Layout布局
- EasyUI之Layout布局
- EasyUI之Layout布局
- iOS巅峰之点击UIAlertView的灰色部分也能dismiss消失
- request.getQueryString
- iOS开发UI篇-CALayer创建图层
- InvokeRequired和Invoke
- iOS开发UI篇-CALayer层的属性、隐式动画
- MySQL--query-cache
- UITextField 光标的位置设置获取
- MSReportBuilder 开发学习二
- 【NGUI】记录button的动态效果
- iOS开发UI篇-CALayer简介
- UINavigationController
- 学习笔记- AVFoundation Programming Guide - 概括
- Compile、Make和Build的区别
- iO 4000 S--集合视图CollectionView
- UITextField
- The requested resource was not found on this server
- Ajax请求中的async:false/true的作用