oscarimonbox
12/7/2015 - 8:50 AM

Cambiar colores NavigationBar y Toolbar

Cambiar colores NavigationBar y Toolbar

// Sacado de CallLegacyViewController.m del proyecto __
// se puede definir esta funcion en prefix.pch:

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

y utilizarla con los colores RGB en constantes (fijadas en el mismo fichero precompilado):

	self.navigationItem.leftBarButtonItem = self.barButtonDismiss;
	self.navigationItem.leftBarButtonItem.tintColor = UIColorFromRGB(Call5ButtonColor);
	[self.navigationController.navigationBar setTitleTextAttributes:
	 @{NSForegroundColorAttributeName: Call5DarkTextColor}];
	self.navigationController.navigationBar.barTintColor = UIColorFromRGB(Call5LightNavigationBarColor);


	self.navigationController.toolbar.tintColor = UIColorFromRGB(Call5ButtonColor);
	self.navigationController.toolbar.barTintColor = UIColorFromRGB(Call5LightToolBarColor);
	self.navigationController.toolbarHidden=NO;
	self.toolbarItems=[self toolbarItemsAsk];