gpt4 book ai didi

iphone - UITableViewCellSelection 样式无法正常工作

转载 作者:行者123 更新时间:2023-11-28 18:38:06 25 4
gpt4 key购买 nike

我正在使用 Xcode 4.5 和 iOS 5.0 开发应用。

在我的应用程序中,我有一个名为 surveyTableViewUITableView 通过 Storyboard 创建。我想要选择我的 surveyTableView 单元格,我正在使用这段代码来实现它。

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
static NSString *cellIdentifier = @"Cell Identifier";
UITableViewCell *cell = [self.surveyTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(!cell)
{
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
cell.textLabel.text = [[self.surveyInfoArray objectAtIndex:indexPath.row] valueForKey:@"SurveyName"];
[cell setSelected:YES];
return cell ;
}

在这种情况下,我只有一个行数为 2 的部分。这是我在屏幕上看到的图像。 Screenshot

你们知道为什么会这样吗?

编辑:我已将UITableView selection attribute设置为Multiple Selection,即使它是Single Line Selection ,我意识到没有区别。

编辑 2:在这里,当我选择 UITableViewCellStyleSubtitle Screenshot2 时,我得到图像

编辑 3:这是有趣的部分,当我现在选择时,这是图像。这让我发疯 Screenshot3

最佳答案

请删除此[cell setSelected:YES];

关于iphone - UITableViewCellSelection 样式无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15496063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com