Transparent UIToolbar

前端 未结 7 956
鱼传尺愫
鱼传尺愫 2021-02-14 19:29

I wrote the following code to make my toolbar transparent.

[mtoolbar setBackgroundColor:[UIColor clearColor]];

How do I make UIToolbar

7条回答
  •  情话喂你
    2021-02-14 19:46

    This worked for me for iOS 6 and 7:

    UIGraphicsBeginImageContextWithOptions(CGSizeMake(1, 1), NO, 0.0);
    UIImage *blank = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    [self.toolBar setBackgroundImage:blank forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
    

提交回复
热议问题