亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

IOS 開發(fā)之實(shí)現(xiàn)取消tableView返回時(shí)cell選中的問題

 更新時(shí)間:2017年09月03日 10:35:01   作者:wy_19921005  
這篇文章主要介紹了IOS 開發(fā)之實(shí)現(xiàn)取消tableView返回時(shí)cell選中的問題的相關(guān)資料,希望通過本文能實(shí)現(xiàn)大家想要的功能,需要的朋友可以參考下

IOS 開發(fā)之實(shí)現(xiàn)取消tableView返回時(shí)cell選中的問題

在對表格UITableView操作時(shí),有時(shí)當(dāng)用戶選中表格行后,需要自動(dòng)取消選擇。實(shí)現(xiàn)這種效果,其原理是選中表格行時(shí),會(huì)調(diào)用 didSelectRowAtIndexPath方法,只要在這個(gè)方法中,調(diào)用performSelector執(zhí)行取消選中表格行的方法。

示例代碼如下: 

- (void) unselectCurrentRow
{

 // Animate the deselection

 [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}

 

- (void)tableView:(UITableView *)tableViewdidSelectRowAtIndexPath:(NSIndexPath *)newIndexPath
{

 // Any other table management you need

 ...

 

 // After one second, unselect the current row

 [self performSelector:@selector(unselectCurrentRow)withObject:nil afterDelay:1.0];

} 

在performSelector中還可以設(shè)定延遲時(shí)間。unselectCurrentRow方法中則完成取消表格行的選擇,并且實(shí)現(xiàn)了動(dòng)畫效果。

如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論