I am adding image to navigation bar it works fine but when i want to add title
self.title=@\"Activity\";
it does not show anything
You can simply hide default navigation bar. and add following code -
NavigationView = [[UIView alloc]init];
NavigationView.frame = CGRectMake(0, 0 , 320, 44);
UIImageView *TopBarImg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
TopBarImg.image = [UIImage imageNamed:@"Nav.png"];
[NavigationView addSubview:TopBarImg];
TopBarImg.userInteractionEnabled = TRUE;
UILabel *TopTitle = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
TopTitle.backgroundColor = [UIColor clearColor];
TopTitle.textAlignment = UITextAlignmentCenter;
TopTitle.text = @"Activity";
TopTitle.textColor=[UIColor whiteColor];
TopTitle.backgroundColor=[UIColor clearColor];
TopTitle.font=[UIFont fontWithName:@"Helvetica-Bold" size :18];
[TopBarImg addSubview:TopTitle];
UIButton *BackButton=[UIButton buttonWithType:UIButtonTypeCustom];
BackButton.Frame = CGRectMake(5, 8, 46, 30);
[BackButton setBackgroundImage:[UIImage imageNamed:@"back_btn.png"] forState:UIControlStateNormal];
[BackButton setBackgroundImage:[UIImage imageNamed:@"back_btn_selected.png"] forState:UIControlStateHighlighted];
[BackButton addTarget:self action:@selector(BackClicked) forControlEvents:UIControlEventTouchUpInside];
[TopBarImg addSubview:BackButton];
[self.view addSubview:NavigationView];
And add one method for back Button click action as follows -
-(void)BackClicked { [self.navigationController popViewControllerAnimated:YES]; }