How can I replicate UINavigationBar's gradient colors?

后端 未结 4 1838
太阳男子
太阳男子 2021-02-06 13:13

I\'ve been trying to replicate the gradient from UINavigationBar to use as a gradient on custom UIButton subclass objects on the same view.

How

4条回答
  •  失恋的感觉
    2021-02-06 14:11

    Short Answer: it is not gradient

    Long Answer: After tint color applied, there is a transparent overlay image rendered on top of it.

    It is called: UITintedTopBarHighlight@2x.png an it is in UIKit artwork. (uploaded here: http://cl.ly/image/2c2V3t1D1T3L)

    It is 2x88 pixel image, and must be repeated horizontally over tinted background.

    For back button, it is very similar, but there is also a mask to give it it's shape. UItintedBackButtonHighlight and UITintedBackButtonMask.

提交回复
热议问题