我想在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