点击Cell的时候 出现一个 小对勾的( 确定UITableViewCell AccessoryCheckmark唯一性)
2015-12-09 16:36
393 查看
a)点击背景会变蓝色
- (UITableViewCellAccessoryType)tableView:(UITableView*)tableViewaccessoryTypeForRowWithIndexPath:(NSIndexPath
*)indexPath
{
if(indexPath.row==currentIndex){
returnUITableViewCellAccessoryCheckmark;
}
else{
returnUITableViewCellAccessoryNone;
}
}
-(void)tableView:(UITableView *)tableViewdidSelectRowAtIndexPath:(NSIndexPath
*)indexPath
{
[tableViewdeselectRowAtIndexPath:indexPath animated:NO];
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.textColor=[UIColor
blueColor];
}
UITableViewCell *oldCell = [tableView
cellForRowAtIndexPath:oldIndexPath];
if(oldCell.accessoryType
==UITableViewCellAccessoryCheckmark){
oldCell.accessoryType
= UITableViewCellAccessoryNone;
oldCell.textColor=[UIColor
blackColor];
}
currentIndex=indexPath.row;
}
b)点击背景不会蓝色
- (void)tableView:(UITableView
*)tableViewdidSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(seletedRow == [indexPath
row])
return;
seletedRow = [indexPath row];
[self.tableView
reloadData];
}
-(UITableViewCellAccessoryType)tableView:(UITableView*)tableViewaccessoryTypeForRowWithIndexPath:(NSIndexPath
*)indexPath
{
int row = [indexPath row];
if(row == select)
returnUITableViewCellAccessoryCheckmark;
returnUITableViewCellAccessoryNone;
}
- (UITableViewCellAccessoryType)tableView:(UITableView*)tableViewaccessoryTypeForRowWithIndexPath:(NSIndexPath
*)indexPath
{
if(indexPath.row==currentIndex){
returnUITableViewCellAccessoryCheckmark;
}
else{
returnUITableViewCellAccessoryNone;
}
}
-(void)tableView:(UITableView *)tableViewdidSelectRowAtIndexPath:(NSIndexPath
*)indexPath
{
[tableViewdeselectRowAtIndexPath:indexPath animated:NO];
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.textColor=[UIColor
blueColor];
}
UITableViewCell *oldCell = [tableView
cellForRowAtIndexPath:oldIndexPath];
if(oldCell.accessoryType
==UITableViewCellAccessoryCheckmark){
oldCell.accessoryType
= UITableViewCellAccessoryNone;
oldCell.textColor=[UIColor
blackColor];
}
currentIndex=indexPath.row;
}
b)点击背景不会蓝色
- (void)tableView:(UITableView
*)tableViewdidSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(seletedRow == [indexPath
row])
return;
seletedRow = [indexPath row];
[self.tableView
reloadData];
}
-(UITableViewCellAccessoryType)tableView:(UITableView*)tableViewaccessoryTypeForRowWithIndexPath:(NSIndexPath
*)indexPath
{
int row = [indexPath row];
if(row == select)
returnUITableViewCellAccessoryCheckmark;
returnUITableViewCellAccessoryNone;
}
相关文章推荐
- iOS 从各种效果图颜色标注生成 UIColor
- IntelliJ IDEA的jsp中request等对象无法被解析的解决办法
- squee_spoon and his Cube VI---郑大校赛(求最长子串)
- easyui ValidateBox validType字段设置多个校验规则
- android 事件处理机制之requestDisallowInterceptTouchEvent
- iOS系列UI篇——UIImageView
- 关于SOAPUI使用的技能
- 通过Fragments建立动态的界面 (UI)
- The type javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required
- 10_15.c先阻塞SIGQUIT信号,再释放。
- vector<struct st_jn_record_plan_week_info> *infoS = &m_PlanInfo[info[i].SubEquId];
- SQL Server2012中的SequenceNumber尝试
- UI -知识点回顾 三
- UIImageView常用属性
- easyui 正则验证电话号码的简单例子
- 【Solutions系列】As-Built Editing,属性编辑实用工具
- Android Studio 运行时出现 finished with non-zero exit value 2
- 在MySQL中创建实现自增的序列(Sequence)的教程
- 夺命雷公狗---PDO NO:6 使用PDO执行SQL语句之query
- 通过@Value注解读取.properties配置内容