iPhone UILabel text soft shadow

前端 未结 15 967
时光取名叫无心
时光取名叫无心 2020-12-07 09:31

I know soft shadows are not supported by the UILabel out of the box, on the iPhone. So what would be the best way to implement my own one?

EDIT:

15条回答
  •  星月不相逢
    2020-12-07 10:10

    Subclass UILabel, as stated, then, in drawRect:, do [self drawTextInRect:rect]; to get the text drawn into the current context. Once it is in there, you can start working with it by adding filters and whatnot. If you want to make a drop shadow with what you just drew into the context, you should be able to use:

    CGContextSetShadowWithColor()
    

    Look that function up in the docs to learn how to use it.

提交回复
热议问题