putting labels, buttons on the navigation bar iOS
ios, uibarbuttonitem, uibutton, uilabel, uinavigationbar
Solution
UINavigationBar *naviBarObj = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 1024, 66)];
UILabel *navLabel = [[UILabel alloc] initWithFrame:CGRectMake(200,8,200,30)];
navLabel.text = @"My Text";
navLabel.textColor = [UIColor redColor];
[naviBarObj addSubview:navLabel];
[navLabel setBackgroundColor:[UIColor clearColor]];
[self.view addSubview:naviBarObj];
try this it will work .It works for me :)
Problem
I have created custom navigation controller, I want to be added, a date at the left, a back button on the right and the title next to back button. I tried to add one label, but it does not work. Please show me a way ``` UINavigationBar *naviBarObj = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 1024, 66)]; UILabel *navLabel = [[UILabel alloc] initWithFrame:CGRectMake(20,8,280,30)]; navLabel.text = @"My Text"; [self.navigationController.navigationBar addSubview:navLabel]; [self.view addSubview:naviBarObj]; ```