ios table实现单选
来源:互联网 发布:vb中sqr是什么意思 编辑:程序博客网 时间:2024/06/06 03:57
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tagsArraycount];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * identifier=@"friendCell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if(!cell)
{
cell=[[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:identifier];
}
NSUInteger row = [indexPath row];
NSUInteger oldRow = [lastIndexPathrow];
[tableView cellForRowAtIndexPath:indexPath].accessoryType = (row == oldRow &&lastIndexPath != nil) ?UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
cell.textLabel.text=[tagsArrayobjectAtIndex:indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int newRow = [indexPath row];
int oldRow = [lastIndexPathrow];
if ((newRow == 0 && oldRow ==0) || (newRow != oldRow))
{
UITableViewCell *newCell = [tableViewcellForRowAtIndexPath:indexPath];
newCell.accessoryType =UITableViewCellAccessoryCheckmark;
UITableViewCell *oldCell = [tableViewcellForRowAtIndexPath: lastIndexPath];
oldCell.accessoryType =UITableViewCellAccessoryNone;
lastIndexPath=indexPath;
}
[tableView deselectRowAtIndexPath:indexPathanimated:YES];
}
- ios table实现单选
- iOS表格实现单选
- table checked单选
- iOS实现单例
- IOS单例实现
- iOS 简单的table实现
- iOS 单例的实现
- iOS单例模式实现
- ios 单例的实现
- iOS 单例模式实现
- IOS单例的实现
- ios 单例实现方式
- iOS 单例模式实现
- ios单例的实现
- iOS Table HeaderView 取消悬浮的实现
- iOS二级Table的简单实现
- iOS中tableview实现单选和多选
- iOS单选和多选的实现
- undefined reference to `uglIoDrvInit'
- 【Avalon】ViewModel:带Setter/Getter的Model Setter/Getter:拦截+同步
- 在CentOS6.2搭建WordPress个人博客
- 找换硬币问题
- MyEclipse,工程项目经验总结(持续更新中)
- ios table实现单选
- libumem使用和源码分析系列文章(一)
- 0019 Servlet容器的实现:单实例多线程的线程安全问题【基础】
- 线程实现定时器(windows下C++版)
- 安装ASPCMS出现:提示:【】错误号:-2147467259 错误描述:未指定的错误
- 旅行一些体会
- C/C++二维数组作为函数参数传递
- 算法导论——输油管道问题解法
- Linux下Samba服务器的安装与配置