I have a title label in the navbar using the code below. I can't seem to get it to size to the width of the full view. Any idea how I might go about fixing this?
I thought self.view.bounds.size.width
would size it to the full width of the view.
here's my navbar title label code and there's also a screenshot to visually show the problem.
thanks for the help
UILabel* tlabel=[[UILabel alloc] initWithFrame:CGRectMake(0,0, self.view.bounds.size.width, 48)];
tlabel.text=self.navigationItem.title;
tlabel.text = @"someText";
tlabel.font = [UIFont fontWithName:@"DIN-Bold" size:20];
tlabel.textColor=[UIColor whiteColor];
tlabel.backgroundColor = [UIColor colorWithRed:(219/255.0) green:(52/255.0) blue:(31/255.0) alpha:1] ;
tlabel.adjustsFontSizeToFitWidth=YES;
tlabel.textAlignment = UITextAlignmentCenter;
self.navigationItem.titleView=tlabel;
after code change from Paras Joshi it's correct on the right side but off on the left.