我需要在我的AVPlayer实例的同一UIProgressView上显示当前时间(蓝色)和缓冲区限制(灰色)。有可能吗?
答案 0 :(得分:0)
您需要使用NSAttributedStrings来完成此任务。
这是一个例子...... 创建一个包含UILabel和UIProgressView作为子视图的自定义UIView。
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Hello. That is a test attributed string."];
[str addAttribute:NSBackgroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(3,5)];
[str addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(10,7)];
[str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Bold" size:20.0] range:NSMakeRange(20, 10)];
label.attributedText = str;
的示例