如何在 UILabel 中製作陰影 (How to make shadow in UILabel)


問題描述

如何在 UILabel 中製作陰影 (How to make shadow in UILabel)

Shadow of UILabel"

I have tried this code 

label.shadowColor = [UIColor blackColor];     label.shadowOffset = CGSizeMake(1.0, 1.0);

but i am unable to get the shadow, i have searched on the internet, but none answers well. http://tinyurl.com/au4exlo , this is a reference site, where a shadow is there under each word.

Please correct my code if am wrong.

Thanks

‑‑‑‑‑

參考解法

方法 1:

I think these are two separate UILabels displaying same values but one is inverted. Additionally, the bottom UILabel is obscured by a half transparent PNG image. 

If you are not familiar with Photoshop, This might give you idea about what I mean by half transparent gradient. http://thepowerpointblog.com/media/blogs/all/10_Sept/Lance_8.jpg

(by abhishek21901Obj‑Swift)

參考文件

  1. How to make shadow in UILabel (CC BY‑SA 3.0/4.0)

#uilabel #XCode






相關問題

標籤邊框內的間距 (spacing inside label's border)

awakeFromNib 無法從 UILabel 獲取值,也無法禁用 UIButton (awakeFromNib can't get value from UILabel and can't disable UIButton)

如何在 UILabel 中製作陰影 (How to make shadow in UILabel)

如何計算 UILabel 的字體大小 (How can I calculate font size of UILabel)

如何在情節提要中為uilabel設置大於300的字體大小? (How to set font size greater than 300 for uilabel in storyboard?)

隨著 UILabel 尺寸的增加,在我的 UILabel 周圍獲得額外的空間 (Getting extra space around my UILabel as it increases in size)

UILabel 不顯示所有內容 (UILabel not displaying everything)

在 UIView 中將標籤居中 (Centering a label in a UIView)

UITableViewCell 未在其中顯示 UILabel (UITableViewCell not showing UILabel within)

帶有 UIMenucontroller 的 UILabel 不會通過外部觸摸退出第一響應者 (UILabel with UIMenucontroller not resigning first responder with touch outside)

UILabel 動態高度問題 (UILabel Dynamic height problem)

是否可以將標籤內的文本與“大”框架垂直對齊 (Is it possible to vertically align text inside labels with a "large" frame)







留言討論