UIButton bottom shadow

后端 未结 11 1134
-上瘾入骨i
-上瘾入骨i 2020-12-12 14:14

I have a UIButton which is very similar to the standard iOS keyboard alphabet button.

I am not sure how to create a shadow only for the bottom layer li

11条回答
  •  囚心锁ツ
    2020-12-12 14:48

    You can try with this code: (sorry, i only know swift, not obj c. this code will add bottom shadow on your button.

    button.layer.masksToBounds = false
    button.layer.shadowColor = UIColor(rgb: 0x000000, alpha: 1.0).CGColor
    button.layer.shadowOpacity = 1.0
    button.layer.shadowRadius = 0
    button.layer.shadowOffset = CGSizeMake(0, 1.0)
    

提交回复
热议问题