单选按钮的实现
来源:互联网 发布:2017编程语言趋势 编辑:程序博客网 时间:2024/05/17 04:45
<pre name="code" class="objc">- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; ColorCell *cell = (ColorCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; NSArray *array = [[NSArray alloc] initWithObjects:@"系统默认色",@"自我本色", @"助运色",@"旺财色",@"旺桃花色",@"其他颜色",@"其他颜色",@"其他颜色",@"其他颜色",@"其他颜色",nil]; NSInteger row = indexPath.row; if (cell==nil) { cell = [[ColorCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ; cell.operationLabel.text = [array objectAtIndex:row]; cell.loginField.tag = row; if(indexPath.row==currentIndex){ cell.accessoryType=UITableViewCellAccessoryCheckmark; } else{ cell.accessoryType=UITableViewCellAccessoryNone; } } return cell; }#pragma mark - UITableView delegate- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath.row==currentIndex){ return; } NSIndexPath *oldIndexPath = [NSIndexPath indexPathForRow:currentIndex inSection:0]; UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath]; if (newCell.accessoryType == UITableViewCellAccessoryNone) { newCell.accessoryType = UITableViewCellAccessoryCheckmark; newCell.selectionStyle = UITableViewCellSelectionStyleNone; } UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:oldIndexPath]; if (oldCell.accessoryType == UITableViewCellAccessoryCheckmark) { oldCell.accessoryType = UITableViewCellAccessoryNone; } currentIndex=indexPath.row; }
0 0
- 单选按钮的实现
- Jsp单选按钮的实现
- cocos2dx radiogrouop单选按钮的实现
- Android 开发 单选按钮的实现
- Datatables之单选按钮的实现
- radioButton单选按钮的实现
- [iphone]实现单选按钮
- 实现点击单选按钮后面的文字说明自动选中相应单选按钮功能
- EXT3.0中关于单选按钮的一种实现
- 1.VC(ui)-单选按钮的自绘实现
- 点击单选按钮 实现表格的隔行变色
- C# 窗体应用程序 之 单选按钮的实现 源代码
- WinForm窗体中多个单选按钮单选的“最简单”实现
- 微信小程序--单选复选按钮组的实现
- 单选按钮的值
- 单选按钮的用法
- PB的单选按钮
- 单选按钮的使用
- Android apk检测病毒-VirSCAN
- Java 中extends与implements使用方法
- 在Lua代码中调用c/C++函数
- activity的启动模式
- 韩顺平老师亲临成都 PHP基础班火爆开班
- 单选按钮的实现
- redis备份机恢复
- java中substring的用法
- 【.NET特供-第三季】ASP.NET MVC系列:MVC与三层图形对比
- Hdu 4845 2048(dp)
- Android程序员必备精品资源
- poj 2175
- Android程序员必备精品资源
- android中ADT和SDK的关系