Showing posts with label tintColor. Show all posts
Showing posts with label tintColor. Show all posts

Tuesday, June 11, 2013

UIToolbar tintColor example in Objective C (iOS).

UIToolbar tintColor

The color used to tint the bar.

@property(nonatomic, retain) UIColor *tintColor

Discussion of [UIToolbar tintColor]
The default value is nil.

UIToolbar tintColor example.
UIToolbar also has a tintColor property, just like a UINavigationBar. You should be able to set one to the other:

myToolbar.tintColor = myNavBar.tintColor;
after you create your toolbar. Keep in mind that this code would only work if myNavBar had been loaded from the NIB, so it would be best to put this in viewWillAppear: or viewDidLoad.


Example of [UIToolbar tintColor].
There no way to compare the colors of navigation bar and tool bar but you can set toolbar color with following code

    aToolbar.barStyle = UIBarStyleBlackTranslucent;
    aToolbar.tintColor = [UIColor blackColor];
    aToolbar.alpha = 0.7;
or

aToolBar.tintColor = [UIColor colorWithRed:0.15 green:0.35 blue:0.45 alpha:0.6];

UIToolbar tintColor example.
// Toolbar content              
NSArray *items=[NSArray arrayWithObjects: ... ]; // PSEUDO CODE HERE
[toolbar setItems:items];

// Add tint
toolbar.tintColor = [UIColor colorWithRed:0.83 green:0.43 blue:0.57 alpha:0.5];
What I needed to do, was just reverse the order of things:

// Add tint
toolbar.tintColor = [UIColor colorWithRed:0.83 green:0.43 blue:0.57 alpha:0.5];

// Toolbar content              
NSArray *items=[NSArray arrayWithObjects: ... ]; // PSEUDO CODE HERE
[toolbar setItems:items]; 

End of UIToolbar tintColor example article.

Monday, June 10, 2013

UITabBar tintColor example in Objective C (iOS).


UITabBar tintColor

The tint color to apply to the tab bar background.

@property(nonatomic, retain) UIColor *tintColor

UITabBar tintColor example.
for me its very simple to change the color of Tabbar like :-

[self.TabBarController.tabBar setTintColor:[UIColor colorWithRed:0.1294 green:0.5686 blue:0.8353 alpha:1.0]];

[self.TabBarController.tabBar setTintColor:[UIColor "YOUR COLOR"];

Example of [UITabBar tintColor].
self.tabBarController.tabBar.tintColor = [[UIColor alloc] initWithRed:0.00
                                                                green:0.62
                                                                 blue:0.93
                                                                alpha:1.0];

UITabBar tintColor example.
- (void)createTabBar:(NSArray*)arguments withDict:
(NSDictionary*)options
{
    UIColor *myNewColor = UIColorFromRGB(0xCD2626);
    tabBar = [UITabBar new];
    [tabBar sizeToFit];
    tabBar.delegate = self;
    tabBar.multipleTouchEnabled   = NO;
    tabBar.autoresizesSubviews    = YES;
    tabBar.hidden                 = YES;
    tabBar.userInteractionEnabled = YES;
        tabBar.opaque = YES;
    tabBar.tintColor = myNewColor;

        self.webView.superview.autoresizesSubviews = YES;

        [ self.webView.superview addSubview:tabBar];

End of UITabBar tintColor example article.

Sunday, June 9, 2013

UINavigationBar tintColor example in Objective C (iOS).


UINavigationBar tintColor

The color used to tint the bar.

@property(nonatomic, retain) UIColor *tintColor

Discussion of [UINavigationBar tintColor]
The default value is nil.

It is permissible to set the value of this property when the navigation bar is being managed by a navigation controller object.

UINavigationBar tintColor example.
Set the barStyle to UIBarStyleBlackTranslucent Set the tintColor like this:

navigationBar.tintColor = [UIColor colorWithRed:.7 green:.5 blue:.2 alpha:1];
This will set the appropriate gradient. Use whatever combination you need.


Example of [UINavigationBar tintColor].
That is one way of doing it. It would probably just be easier in you ViewController where ever you need to change it add the line:

self.navigationController.navigationBar.tintColor = [UIColor redColor];

UINavigationBar tintColor example.
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    tintBarColor = [UIColor  
                colorWithRed:50.0/255  
                green:134.0/255  
                blue:187.0/255  
                alpha:1];
    self.navigationController.navigationBar.tintColor = tintBarColor;
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    [tintBarColor release];
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on     demand.
    // For example: self.myOutlet = nil;
}

End of UINavigationBar tintColor example article.

Thursday, May 30, 2013

UIButton tintColor example in Objective C (iOS).

UIButton tintColor

The tint color for the button.

@property(nonatomic, retain) UIColor *tintColor

Discussion of [UIButton tintColor]
The default value is nil.

This property is not valid for all button types.

UIButton tintColor example.
UISegmentedControl *cancelButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Cancel"]];
[cancelButton setSegmentedControlStyle:UISegmentedControlStyleBar];
[cancelButton setTintColor:[UIColor colorWithRed:0.8 green:0.3 blue:0.3 alpha:1.0]];
[cancelButton setMomentary:YES];
[cancelButton addTarget:self action:@selector(didTapCancel:) forControlEvents:UIControlEventValueChanged];
[self addSubview:cancelButton];
[cancelButton release];

Example of [UIButton tintColor].
self.loginButton.tintColor = [UIColor redColor];

UIButton tintColor example.
UIColor *color = [[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.0]; 
button.tintColor = color;

End of UIButton tintColor example article.