How to make UIToolbar have a Clear Background?

前端 未结 8 1827
渐次进展
渐次进展 2021-02-05 12:54

I have a UIToolbar that has a white tint, with a bar button item, followed by some flexible space, followed by another bar button item. I would like to make the toolbar complete

8条回答
  •  醉酒成梦
    2021-02-05 13:45

    Subclass UIToolbar, and implement the below method:

    - (void)drawRect:(CGRect)rect 
    {
      [[UIColor colorWithWhite:0 alpha:0.6f] set]; // or clearColor etc
      CGContextFillRect(UIGraphicsGetCurrentContext(), rect);
    }
    

    see more details here

提交回复
热议问题