How do I show exactly the same color in UIToolbar and NavigationBar?
I'm trying to add a UIToolbar that shows the user karma in a
NavigationBar. The problem I have is that the colors are not exactly
equals, as you can see at the photo.
So, any idea How could I resolve this? Here is the code:
- (void)viewDidLoad
{
[super viewDidLoad];
UIToolbar *tools = [[UIToolbar alloc]
initWithFrame:CGRectMake(0.0f, 0.0f, 80.0f, 45.00f)];
UILabel *karma = [[UILabel alloc] initWithFrame:CGRectMake(30.0f, 0.0f,
40.0f, 44.00f)];
karma.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"karma"];
karma.font = [UIFont fontWithName:@"Helvetica" size:(14.0)];
karma.textColor = [UIColor colorWithRed:(255.0) green:(255.0) blue:(255.0)
alpha:1];
karma.backgroundColor = [UIColor colorWithRed:(64/255.0) green:(64/255.0)
blue:(64/255.0) alpha:0];
UIImage *image = [UIImage imageNamed:@"ic_people.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(0.0f, 7.5f, 30.0f, 30.00f);
// Add Pin button.
[tools setBarStyle: UIBarStyleDefault];
[tools addSubview:karma];
[tools addSubview:imageView];
// Add toolbar to nav bar.
UIBarButtonItem *karmaNav = [[UIBarButtonItem alloc]
initWithCustomView:tools];
self.navigationItem.rightBarButtonItem = karmaNav;
...
Thank you.
No comments:
Post a Comment