相关疑难解决方法(0)

UIView:opaque vs. alpha vs. opacity

opaque alpha对于UIView,背景的不透明度和不透明度如何协同工作以及它们之间有什么区别?

UIView http://i.minus.com/jb2IP8TXbYTxKr.png

iphone objective-c uiview ios

56
推荐指数
2
解决办法
4万
查看次数

为什么具有UISegmentedControl对象的自定义表格视图单元格的滚动性能较差?

我有一个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)

scroll uitableview

14
推荐指数
1
解决办法
1万
查看次数

启用"颜色混合图层"时,是否可以将非英文字符的UILabel设为绿色?

我有一个自定义单元格的表格视图,我尝试通过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帖子提供了有关情况的一些解释.实际上有解决方案吗?

core-graphics uitableview uikit uilabel ios

6
推荐指数
1
解决办法
669
查看次数