我想把選取框標籤中的UITableView細胞,但與costomized像標籤的文字是不同的顏色我想把選取框標籤不同的標籤的文本顏色
我使用MarqueeLabel類和我能夠顯示字幕標籤在UITableViewCell上,它是完美的工作。
我也試過NSAttributedString但MarqueeLabel不支持不同顏色的標籤文本的
如果有人有答案,那麼請給我
感謝。
這裏是我的代碼
[cell.contentView addSubview:[self createMarqueeLabelWithIndex:indexPath.row]];
[cell.textLabel setTextColor:[UIColor redColor] range:NSMakeRange(4, 3)];
-(MarqueeLabel *)createMarqueeLabelWithIndex:(int)index
{
MarqueeLabel *continuousLabel2 = [[MarqueeLabel alloc] 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 = [UIColor clearColor];
continuousLabel2.font = [UIFont fontWithName:@"Helvetica-Bold" size:17.000];
NSString *strText = [[arrTicker objectAtIndex:index] objectForKey:@"text"];
NSString *strTime = [[arrTicker objectAtIndex:index] objectForKey:@"time"];
NSString *strUser = [[arrTicker objectAtIndex:index] objectForKey:@"userid"];
NSString *strTemp = [NSString stringWithFormat:@"%@ %@ %@ ",strText,strTime,strUser];
continuousLabel2.text = [NSString stringWithFormat:@"%@",strTemp];
return continuousLabel2;
}
POst你的一些代碼。 – user1673099
我發佈了代碼 –
編輯您用於支持來自屬性字符串的顏色的選取框標籤源代碼。然後提出一個拉請求給這個顏色支持回社區。 –