欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

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

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

在對(duì)表格UITableView操作時(shí),有時(shí)當(dāng)用戶(hù)選中表格行后,需要自動(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)畫(huà)效果。

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

相關(guān)文章

最新評(píng)論