ios - 我想用不同的标签文本颜色放置 Marquee Label
<p><p>我想将选取框标签放在 UITableView 单元格中,但标签文本的颜色不同</p>
<p>我正在使用 MarqueeLabel 类,我能够在 UITableViewCell 上显示该 Marquee Label,而且效果很好。</p>
<p>我也试过 NSAttributedString 但 MarqueeLabel 不支持不同颜色的标签文本</p>
<p>如果有人有答案,请给我</p>
<p>谢谢。</p>
<p>这是我的代码</p>
<pre><code>];
range:NSMakeRange(4, 3)];
-(MarqueeLabel *)createMarqueeLabelWithIndex:(int)index
{
MarqueeLabel *continuousLabel2 = [ initWithFrame:CGRectMake(10,0,300,30) rate:50.0f andFadeLength:10.0f];
continuousLabel2.marqueeType = MLContinuous;
continuousLabel2.continuousMarqueeSeparator = @"";
continuousLabel2.animationCurve = UIViewAnimationOptionCurveLinear;
continuousLabel2.numberOfLines = 1;
continuousLabel2.opaque = NO;
continuousLabel2.enabled = YES;
continuousLabel2.shadowOffset = CGSizeMake(0.0, -1.0);
continuousLabel2.textAlignment = UITextAlignmentLeft;
continuousLabel2.backgroundColor = ;
continuousLabel2.font = ;
NSString *strText = [ objectForKey:@"text"];
NSString *strTime = [ objectForKey:@"time"];
NSString *strUser = [ objectForKey:@"userid"];
NSString *strTemp = ;
continuousLabel2.text = ;
return continuousLabel2;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>在您的 cellforrowatindexpath 中创建 uilabel 并分配您的品牌标签,而不是将 uilabel 的文本设置为属性字符串,然后将 uilabel 转换为品牌标签,然后将 subview 添加到您的单元格。</p>
<p>希望这对您有所帮助。
谢谢。</p></p>
<p style="font-size: 20px;">关于ios - 我想用不同的标签文本颜色放置 Marquee Label,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/19603447/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/19603447/
</a>
</p>
页:
[1]