UIToolBar is Transparent

When I add a UIToolBar, it appears to be transparent. However, I do not want this to happen. Here is my code:

var done = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: Selector("done"))

    if let font = UIFont(name: "Avenir", size: 17.0) {
        done.setTitleTextAttributes([NSFontAttributeName: font], forState: .Normal)
    }
    toolBar.items = [done]
    toolBar.barStyle = UIBarStyle.Default
    self.birthdayTextField.inputAccessoryView = toolBar

Am I doing anything wrong?

Having come across this issue myself I found that the toolbar must either be instantiated with a non-zero frame, or have sizeToFit called on it.

e.g.

    let tb = UIToolbar()
    tb.translucent = false
    tb.items = [UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: nil, action: nil), UIBarButtonItem.init(title: "A button", style: .Plain, target: self, action: Selector("someAction:"))]
    tb.sizeToFit()
    userField?.inputAccessoryView = tb

or

    let tb = UIToolbar(CGRectMake(0,0,view.frame.width,44))
    tb.translucent = false
    tb.items = [UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: nil, action: nil), UIBarButtonItem.init(title: "A button", style: .Plain, target: self, action: Selector("someAction:"))]
    userField?.inputAccessoryView = tb

translucent, A Boolean value that indicates whether the toolbar is translucent ( YES ) or not ( NO ). SDKs. iOS 3.0+; Mac Catalyst 13.0+. Framework. UIKit. Transparent UIToolBar Sometimes it is really necessary to have a transparent UIToolBar within you iPhone app. Especially if you want to add a UIToolBar to your UINavigationBar you get some problems with overlaying backgrounds (UIBarStyleBlackOpaque did not work for a toolbar on a black opaque navigation bar).

try this code for UIToolBar Transparent :

self.toolbar.setBackgroundImage(UIImage(),
                                forToolbarPosition: UIBarPosition.Any,
                                barMetrics: UIBarMetrics.Default)
self.toolbar.setShadowImage(UIImage(),
                            forToolbarPosition: UIBarPosition.Any)

Transparent UIToolBar, Sometimes it is really necessary to have a transparent UIToolBar within you iPhone app. Especially if you want to add a UIToolBar to your  How to draw a transparent UIToolbar or UINavigationBar in iOS7 - TransparentBar.m. You could hack around that by creating a single pixel PNG image with #7919CA / 0.8, making it a resizable UIImage and setting that as the background image instead.

This should disable the translucency/transpacency effect

toolbar.translucent = false

How to draw a transparent UIToolbar or , navigationBar.shadowImage = [UIImage new];. self.navigationBar.translucent = YES;. // Transparent UIToolbar. [self.toolbar setBackgroundImage:[UIImage new]​  @property (nonatomic, assign, getter=isTranslucent) BOOL translucent; Discussion When the toolbar is translucent, configure the edges For Extended Layout and extended Layout Includes Opaque Bars properties of your view controller to display your content underneath the toolbar.

Try this

toolBar.barStyle = UIBarStyle.Black

and make sure toolBar.translucent = false

Setting a toolbar's background to transparent, [[UIToolbar appearance] setTintColor:[[UIColor alloc] initWithRed:0 green:0 but I'd really love to have the toolbar completely transparent. The UIToolbar Delegate protocol defines the interface that toolbar delegate objects implement to manage the toolbar behavior. This protocol declares no methods of its own but conforms to the UIBar Positioning Delegate protocol to support the positioning of a toolbar when it is moved to a window.

In Xamarin (similar for swift)

toolbar.Translucent = false;
toolbar.BarTintColor = color;

UIToolbar setItems changes Toolbar Background Color, The toolbar is transparent when I add BarButtonItems through Interface Builder. When I try to set What can I do to maintain the transparency of the UIToolbar? A sample app showing how to have a transparent UIToolbar that floats above the keyboard - cwalcott/UIToolbar-Keyboard-Example

Bar Tint on UIToolBar when translucent is false, I try to set the Bar Tint Color (in Interface Builder) on a UIToolbar that has translucent set to off. No matter the color I choose, the toolbar is always white in the  The following works in iOS 5 (and iOS 6 beta 4, although a slight top shadow is still visible there). Please note: Making a UIToolbar or UINavigationBar transparent is rarely a good idea, and modifying Apple's UIKit elements in such a way is bound to break sooner or later.

iPhone SDK Application Development: Building Applications for the , create a UIToolbar object and assign your array of buttons as the toolbar's list of white text UIBarStyleBlackTranslucent Transparent blackbackground with  Transparent is an American comedy-drama web television series created by Jill Soloway for Amazon Studios that debuted on February 6, 2014. The story revolves around a Los Angeles family and their lives following the discovery that their parent ( Jeffrey Tambor ) is a trans woman named Maura. [4]

Transparent UIToolbar - iphone, I wrote the following code to make my toolbar transparent. [mtoolbar setBackgroundColor:[UIColor clearColor]]; How do I make UIToolbar transparent​?

Comments
  • Sorry if I wasn't clear before. I don't want my toolBar to be transparent. For some reason, the code I provided produces a transparent toolBar.
  • Thank you for the response! I tried this, but it still has a transparent/translucent effect.