opaque alpha对于UIView,背景的不透明度和不透明度如何协同工作以及它们之间有什么区别?
我有一个UITableView,其中包含在xib文件中定义的自定义单元格,当单元格上有UISegmentedControl时,我的设备上的滚动性能(不稳定)很差.NSLog语句显示正在分配和重用它们应用的单元.我的cellForRowAtIndexPath方法的代码如下.根据Apple的文档,在xib中进行连接.(在模拟器btw中顺利滚动)
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
[[NSBundle mainBundle] loadNibNamed:@"TableViewCell"
owner:self
options:nil];
cell = self.tvCell;
self.tvCell = nil;
}
cell.layer.shouldRasterize = YES; // build error is here
UILabel *lbl = (UILabel *)[cell viewWithTag:1];
[lbl setText:[NSString stringWithFormat:@"Q%i", indexPath.row+1]];
return cell;
}
Run Code Online (Sandbox Code Playgroud) 我有一个自定义单元格的表格视图,我尝试通过Color Blended Layer在模拟器中检查单元格内的所有子视图为绿色来优化它.
当UILabel单元格中的背景设置为白色时:
let title = UILabel()
contentView.addSubview(title)
title.background = UIColor.whiteColor()
title.text = "Hi, how are you?"
Run Code Online (Sandbox Code Playgroud)
这个UILabel子视图在模拟器中会变成绿色,这很好.但是,如果我将文本更改为某些中文:
title.text = "??"
Run Code Online (Sandbox Code Playgroud)
UILabel子视图将变为红色.这篇SO帖子提供了有关情况的一些解释.实际上有解决方案吗?