Iphone UITableView选择淡出

Iphone UITableView选择淡出,iphone,iphone-sdk-3.0,Iphone,Iphone Sdk 3.0,如何在tableView单元格背景色出现时立即为其提供淡入淡出效果。我知道如何在表格视图出现时选择单元格,但颜色永远保持不变。我希望它能在那里停留2秒钟或其他时间,然后逐渐消失 有人说我应该使用[tableView performSelector],所以我写了以下内容: -(void) viewdidLoad { [tableView performSelector:@(highlight) withObject:nil afterDelay:2]; } -(void) highlig

如何在tableView单元格背景色出现时立即为其提供淡入淡出效果。我知道如何在表格视图出现时选择单元格,但颜色永远保持不变。我希望它能在那里停留2秒钟或其他时间,然后逐渐消失

有人说我应该使用[tableView performSelector],所以我写了以下内容:

-(void) viewdidLoad {
    [tableView performSelector:@(highlight) withObject:nil afterDelay:2];
}

-(void) highlight
{
//I have a row selected as soon as my view appears

    -[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
}
但当我使用它时,我的应用程序崩溃了。我认为崩溃与withObject属性有关

有人能帮我吗?

高亮显示方法属于控制器对象,而不是表视图。如果在第二行将tableView更改为self,应用程序将停止崩溃

-(void)viewDidAppear:(BOOL)animated {
    [self performSelector:@selector(highlight) withObject:nil afterDelay:5];
    [super viewDidAppear:animated];
}
-(void)highlight{
   [tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
}
这对我很有用,我想你可能在performSelector中漏掉了@selector。请注意延迟,因为据我记忆所及,Apple UI指南中不建议在导航回视图后选择表格单元格