[英]UILabel blur only text
我試圖模糊以編程方式創建的標簽的文本,我已經能夠將模糊應用到標簽本身,而僅將文本應用於標簽,使文本可讀並且僅模糊標簽后面的背景。
有什么方法可以只模糊文本嗎?
提前致謝。
編輯:
到目前為止,這是我的代碼:
UILabel *lblVericalName =
[[UILabel alloc]initWithFrame:CGRectMake(-95,
_viewVerticalStick.frame.size.height-120,
200,
20)];
lblVericalName.tag = [tarefaDiaArray.idTarefaDia integerValue];
lblVericalName.text = tarefaDiaArray.nomeTarefa;
lblVericalName.transform=CGAffineTransformMakeRotation( M_PI+89.55 );
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurEffectView =
[[UIVisualEffectView alloc] initWithEffect:blurEffect];
blurEffectView.frame = lblVericalName.bounds;
blurEffectView.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[viewStickBackground addSubview:lblVericalName];
if ([tarefaDiaArray.tarefaPremium intValue] ==1) {
//[viewStickBackground addSubview:blurEffectView];
[lblVericalName addSubview:blurEffectView];
}
編輯2:
更新
我已經取得了一些進展,現在有了這個:
我需要使它看起來像這樣:
這是我正在使用的代碼:
lblNomeVertical.textColor = [UIColor colorWithRed:0.494綠色:0.494藍色:0.494 alpha:0.8];
lblNomeVertical.layer.shadowOffset = CGSizeMake(1, 1.1);
lblNomeVertical.layer.shadowColor = [UIColor colorWithRed:0.827 green:0.827 blue:0.827 alpha:1].CGColor;
lblNomeVertical.layer.shadowRadius = 1.0;
lblNomeVertical.layer.shadowOpacity = 1;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.