我对重用标识符系统的行为很好奇。我正在使用一个uitableviewcell单元格,上面有两个不同的uilabels。标签一始终存在并且正在正确更新,标签二以.alpha=0开头,并在特定单元内的特定条件下出现。
标签一是疑似行为,标签两个行为很奇怪,当我第一次加载场景(Viewdidload)时,它看起来像它应该出现的样子。当我向下滚动并找到一个uitableviewcell单元格时,它的标签为.alpha=1,因为它满足条件。
到目前为止,一切都正常,但现在如果我向上滚动,所有标签2都有一个.alpha=1。
在做了一些研究之后,我得出的结论是,这与我重新定义重用标识符单元格模板的编程方式有关。我的问题是,有没有办法将"buffer“重置为我在storyboard中创建的uitableview单元格,而它没有我在编程中所做的更改。另外,由于这些是我自己的推论,我的假设可能是错误的,感谢您的时间。
发布于 2014-12-15 03:45:44
您的单元格从.alpha =1开始,因为reuseIdentifier已经看到.alpha = 1,并为该参数设置另一个sell。首先,您可以单独控制每个单元格的.alpha参数。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"FeedbackCell";
VZDetailFeedbackTableViewCell *cell = (VZDetailFeedbackTableViewCell *)[self.p_tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[VZDetailFeedbackTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// There can be more cells with Identifier
CGFloat alpha = 1.0f;
//if (something)
{
alpha = 0.0f;
}
[cell setSellAlpha:alpha];
}
// In your custom cell class you make method setAlpha and there control visibilityhttps://stackoverflow.com/questions/27472638
复制相似问题