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

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

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

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

在對表格UITableView操作時,有時當用戶選中表格行后,需要自動取消選擇。實現(xiàn)這種效果,其原理是選中表格行時,會調(diào)用 didSelectRowAtIndexPath方法,只要在這個方法中,調(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中還可以設定延遲時間。unselectCurrentRow方法中則完成取消表格行的選擇,并且實現(xiàn)了動畫效果。

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

相關文章

最新評論