How to set background color of navigation bar in iPhone
just type the following code in -viewDidLoad method
UIView *naview=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
naview.backgroundColor = [UIColor colorWithRed:112/255.f green:50/255.f blue:19/255.f alpha:255/255.f];
UILabel *titleLabel=[[UILabel alloc] initWithFrame:CGRectMake(80, 5, 200, 25)];
titleLabel.textColor=[UIColor colorWithRed:255/255.f green:255/255.f blue:215/255.f alpha:255/255.f];
[titleLabel setBackgroundColor:[UIColor clearColor]];
titleLabel.text=@"title";
[naview addSubview:titleLabel];
[self.navigationController.navigationBar addSubview:naview];
UIView *naview=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
naview.backgroundColor = [UIColor colorWithRed:112/255.f green:50/255.f blue:19/255.f alpha:255/255.f];
UILabel *titleLabel=[[UILabel alloc] initWithFrame:CGRectMake(80, 5, 200, 25)];
titleLabel.textColor=[UIColor colorWithRed:255/255.f green:255/255.f blue:215/255.f alpha:255/255.f];
[titleLabel setBackgroundColor:[UIColor clearColor]];
titleLabel.text=@"title";
[naview addSubview:titleLabel];
[self.navigationController.navigationBar addSubview:naview];
Comments
Post a Comment