Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
UILabelテキストを動的に変更する要素がいくつかあります。label.Layer.ShadowOffsetまた、ディトカラーを使用してラベルにシャドウを追加します。
UILabel
label.Layer.ShadowOffset
ラベルのテキストが変更された場合、私はを使用しますSizeToFit。問題:この方法では影が考慮されていません。ラベルが小さすぎて影がカットされてしまいます。
SizeToFit
SizeToFitこれを修正する簡単な方法はありますか、それとも呼び出し後に手動でサイズを変更する必要がありますか?
UILabel の shadowOffset および shadowColor プロパティを使用する代わりに、レイヤーに影を設定するのはなぜですか? その場合、sizeToFit が影を考慮に入れることを期待します。