XZ_iOS中只选中一个button
来源:互联网 发布:数控编程圆弧怎么编程 编辑:程序博客网 时间:2024/05/29 19:25
有的时候tableView的每一行cell的右侧都是一个button,但是我们需要实现的功能是其中一个为选中状态,其他按钮选中状态为不选中状态,这时候我们可以设置一个中间的成员变量CurrentBtn,用来记录当前是哪一个button,用它来进行操作,代码如下:
// 当前点击的button
@property (nonatomic, strong) UIButton *currentBtn;
// 只有一个button能点
if (self.currentBtn != button) {
self.currentBtn.selected = !self.currentBtn.selected;
self.currentBtn = button;
button.selected = YES;
}else {
self.currentBtn.selected = !self.currentBtn.selected;
}
// 让tableView默认选中第一行
NSIndexPath * path = [NSIndexPath indexPathForRow:0 inSection:0];
[self tableView:self.tableView didSelectRowAtIndexPath:path];
0 0
- XZ_iOS中只选中一个button
- 关于实现多个button只实现可以选中一个的代码
- checkbox 只选中一个
- Button只弹出一个PopUp窗体
- 只选中GridView中的一个CheckBox
- 只选中GridView中的一个CheckBox
- 多个uibutton 只选中其中一个
- ListView中实现互斥按钮(每个Item中有两个button,永远只有一个item中的一个按钮被选中)
- Android button边框线,只定义一个边框的颜色
- 多个RadioGroup,只允许一个选中的解决方案
- JQuery 实现多个checkbox 只选中一个
- checkbox 之只选中一个时 ,不勾选问题
- 运用Button删除GridView中CheckBox选中行
- android小问题:代码中设置Button被选中
- XZ_iOS中清除缓存的实现
- 如何在EditText中嵌入一个Button
- jsp中,一个button onclick跳转
- 2、QT中创建一个Button
- python学习——使用WEB框架
- WebService-wsimport
- Codeforces Round #363 (Div. 2) C. Vacations
- 感悟
- strcpy、memcp、memset的区别
- XZ_iOS中只选中一个button
- Oracle中TO_DATE TO_CHAR格式
- 响应式布局项目总结
- Javassist library is missing in classpath! Please add missed dependency!异常
- SQL分组取每组前一(或几)条记录(排名)
- 冒泡排序
- [Cloud Computing]Mechanisms: Pay-Per-Use Monitor
- Android缓存
- python介绍