Tuesday, June 11, 2013

UIToolbar translucent example in Objective C (iOS).

UIToolbar translucent

A Boolean value that indicates whether the toolbar is translucent (YES) or not (NO).

@property(nonatomic, assign, getter=isTranslucent) BOOL translucent

Discussion of [UIToolbar translucent]
Applying translucence to a toolbar is intended primarily for landscape orientation, when you want the user to be able to view the area beneath the toolbar. The default value for this property is NO. However, if you set the toolbar style to UIBarStyleBlackTranslucent, the value for this property is always YES.

UIToolbar translucent example.
The best you can do is using

[helloToolbar setBarStyle:UIBarStyleBlack];
[helloToolbar setTranslucent:YES];
This will get you a black but translucent toolbar.


Example of [UIToolbar translucent].
// Set properties to make background
// translucent.
- (void) applyTranslucentBackground
{
    self.backgroundColor = [UIColor clearColor];
    self.opaque = NO;
    self.translucent = YES;
}

// Override init.
- (id) init
{
    self = [super init];
    [self applyTranslucentBackground];
    return self;
}

// Override initWithFrame.
- (id) initWithFrame:(CGRect) frame
{
    self = [super initWithFrame:frame];
    [self applyTranslucentBackground];
    return self;
}

UIToolbar translucent example.
check the following line of code

 _toolbar.barStyle = UIBarStyleBlackTranslucent;//Deprecated
EDIT

  _toolbar.barStyle = UIBarStyleBlack;
  _toolbar.translucent = YES;
check the UIInterface.h Class in UIKit.Framework


End of UIToolbar translucent example article.