我想在UITableView
的第一行中添加一些特殊效果,但是當我向下滾動表格視圖時,它也會與其他單元格一起顯示(因爲單元格的可重用性?)。那麼有沒有什麼辦法可以防止任何特定的細胞被重複使用?我嘗試將nil
作爲reusableIndentifier傳遞給第一個細胞,但它給我帶來了錯誤(插入失敗)。有沒有可能不重用UITableView中的特定單元格?
我打電話從viewDidApper
法這種方法對於一些動畫的第一行向
-(void)openSubmenuForFirstRow{
stIndex = 0;
UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
StoreCell* sCell = (StoreCell *)cell;
UIView* mainView = [sCell viewWithTag:101];
UIView* subView = [sCell viewWithTag:102];
[UIView animateWithDuration:0.3 animations:^{
CGRect rect = subView.frame;
rect.origin.x = 0;
subView.frame = rect;
CGRect mainViewRect = mainView.frame;
mainViewRect.origin.x = 117;
mainView.frame = mainViewRect;
}];
}
但是當我滾動表視圖我得到幾個其他細胞中,這種動畫。 任何幫助或建議,將不勝感激。
如果對這些單元使用不同的'reusableIndentifier',它應該可以工作。 reusableIndentifier是爲了命名單元格的類型..所以你總是得到正確的。 – Bastian
你在哪裏調用openSubmenuForFirstRow? – mxb
@mxb正如我在'viewDidAppear'方法中提到的那樣 – Bharat