Xcode 5.0、iOS 7 并更新现有应用程序。UITableView
所选行现在是灰色的,而不是蓝色的。
据我所知,他们更改了默认值selectionStyle
至灰色。但“蓝色”仍然是 IB 的一个选项UITableViewCellSelectionStyleBlue
仍然存在。查看新的 HIG,看起来他们并没有删除蓝色,并且“设置”应用程序仍然使用蓝色单元格选择。
我尝试过在 IB 和代码中设置该值,但没有成功。关于我需要做什么才能恢复蓝色选择样式有什么想法吗?
iOS7 中只有一种选择样式,要更改您需要手动执行此操作,如下所示:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
....
UIView *bgColorView = [[UIView alloc] init];
bgColorView.backgroundColor = [UIColor colorWithRed:(76.0/255.0) green:(161.0/255.0) blue:(255.0/255.0) alpha:1.0]; // perfect color suggested by @mohamadHafez
bgColorView.layer.masksToBounds = YES;
cell.selectedBackgroundView = bgColorView;
....
return cell;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)