Programmatically adding a shadow to a UIButton label

前端 未结 6 579
盖世英雄少女心
盖世英雄少女心 2021-02-04 03:15

I\'m trying to add a 1px black drop shadow to a button label with no luck. I\'ve tried this:self.setTitleShadowOffset = CGSizeMake(0, -1); but I get:

6条回答
  •  长发绾君心
    2021-02-04 04:17

    The setTitleShadowOffset for UIButton is deprecated. Use the shadowOffset of titleLabel property of UIButton

    buttonName.titleLabel.shadowOffset = CGSizeMake(0, -1);

提交回复
热议问题