Why does uitableview cell remain highlighted?
What would cause a tableview cell to remain highlighted after being touched? I click the cell and can see it stays highlighted as a detail view is pushed. Once the detail view is popped, the cell is still highlighted.
#######
In your didSelectRowAtIndexPath you need to call deselectRowAtIndexPath to deselect the cell.
So whatever else you are doing in didSelectRowAtIndexPath you just have it call deselectRowAtIndexPath as well.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Do some stuff when the row is selected
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
deselectRowAtIndexPath
in my viewDidAppear, if select the row brings up a new view. – notnoop Dec 3 '09 at 15:59 -deselectRowAtIndexPath:animated:
method on its tableView property from -viewDidAppear
. However, if you have a table view in a UIViewController subclass, you should call -deselectRowAtIndexPath:animated:
from -viewDidAppear
yourself. :) – Daniel Tull Dec 4 '09 at 12:19 -viewWillAppear:
that broke it. Adding a call to [super viewWillAppear:animated]
got it working again. – Ben Challenor Jul 6 '11 at 9:38 UITableViewController
's clearsSelectionOnViewWillAppear
property is set to YES
(which is the default), and you haven't prevented [super viewWillAppear]
from being called. – Defragged Oct 31 '11 at 10:26 - (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Unselect the selected row if any
NSIndexPath* selection = [self.tableView indexPathForSelectedRow];
if (selection) {
[self.tableView deselectRowAtIndexPath:selection animated:YES];
}
}
This way you have the animation of fading out the selection when you return to the controller, as it should be.
Taken from http://forums.macrumors.com/showthread.php?t=577677
http://stackoverflow.com/questions/1840614/why-does-uitableview-cell-remain-highlighted#comment1733845_1840757
Why does uitableview cell remain highlighted?的更多相关文章
- UITableView cell复用出错问题 页面滑动卡顿问题 & 各杂七杂八问题
UITableView 的cell 复用机制节省了内存,但是有时对于多变的自定义cell,重用时会出现界面出错(例如复用出错,出现cell混乱重影).滑动卡顿等问题,这里只简单敲下几点复用出错时的解决 ...
- UITableview cell 的多选
利用NSMutableDictionary key值 来改变cell的状态 -(void)createUI{ table = [[UITableView alloc]initWithFrame:CG ...
- UITableView cell中label自动换行和自定义label自动换行
换行的前提必须是有足够的高度 才能换 否则不显示超出部分 所以,在设置label换行的时候 要考虑cell的高度,cell的高度也要变化,废话不多说,来段代码: cell.label.text=[di ...
- UITableView Cell 弹簧动画效果
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath ...
- Swift - UIView,UItableView,Cell设置边框方法
// 设置边框的宽度 cell.layer.borderWidth = 1 // 设置边框的颜色 cell.layer.borderColor = UIColor.blackColor().CGCol ...
- UITableview cell中多个按钮
xib的 //不使用这种- (IBAction)button:(UIButton *)sender; //使用这种 @property (weak, nonatomic) IBOutlet UIBut ...
- UITableView cell 半透明效果,改变cell高度时背景不闪的解决方法
如果直接指定cell.backgroundColor = = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 ...
- 【iOS】UITableview cell 顶部空白的n种设置方法
我知道没人会主动设置这个东西,但是大家一定都遇到过这个问题,下面总结下可能是哪些情况: 1, self.automaticallyAdjustsScrollViewInsets = NO; 这个应该 ...
- IOS 7 UITableView cell lines不能靠左解决方法
添加一句:[UITableViewappearance].separatorInset=UIEdgeInsetsZero; 就可以解决啦.
随机推荐
- 在.NET2.0中解析Json和Xml
在.NET解析json有很多方法,这里介绍最简单也用的最多的一种. 一.添加引用 解析Json,先下载开源控件 Newtonsoft.Json.dll 下载地址:http://files.cnblog ...
- (图 BFS)走迷宫
题目: 给一个迷宫,求出从起点到终点的路径.迷宫 src.txt 文件内容如下,第一行是迷宫的行列数,后面行是迷宫,1表示可行走,0表示不可以通过,起点是最左上角,终点是最右下角: 解析: 其实就是图 ...
- 新手浅谈Task异步编程和Thread多线程编程
初学Task的时候上网搜索,看到很多文章的标题都是task取代thread等等相关,我也一直以为task和thread是一类,其实task是.net4.0提出的异步编程,在之前.net1.0有dele ...
- 数据库mysql的基本命令
问题分析 当数据量很大的时候,所有数据都集中在一个文本文件中的话,读写会很困难,内存消耗大,速度很慢 操作很麻烦,因为读写都要根据指定的格式尽心解析,不通用 每次获取数据都要全部数据重新读写,不能通过 ...
- JavaScript中this详解
这里的主题是 this ,不扯远了.this 本身原本很简单,总是指向类的当前实例,this 不能赋值.这前提是说 this 不能脱离 类/对象 来说,也就是说 this 是面向对象语言里常见的一个关 ...
- ES2015 ——let命令的暂时性死区
ES6新增了let命令,用来声明变量.它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效. 和var不同的还有,let命令不存在变量提升,所以声明前调用变量,都会报错,这就涉及到 ...
- luigi学习2-在hadoop上运行Top Artists
一.AggregateArtistsHadoop class AggregateArtistsHadoop(luigi.contrib.hadoop.JobTask): date_interval = ...
- centos查看设置端口开放状态
centos查看端口是否已开放/etc/init.d/iptables status centos开放端口/sbin/iptables -I INPUT -p tcp --dport 8000 -j ...
- android任意view爆炸效果--第三方开源--ExplosionField
犹如天女散花一样,爆炸散列,比较有趣.Android ExplosionField在github上的项目主页是:https://github.com/tyrantgit/ExplosionField ...
- SSM框架
1.http://www.cnblogs.com/verlen11/p/5349747.html 2.Mybatis http://www.cnblogs.com/xdp-gacl/p/4261895 ...