0

I am new to iPhone. I have a small doubt that is I am created one project in that I am place one button when I click on that it opens UIWebView in that UIView i want a navigation bar with back button how it is possible.for this,I have written some code but here i am not able to create back button.If any body know this please help me... The below code I have written for this

BiblePlayerViewController.m

- (IBAction)aboutUsButtonClicked:(id)sender {

         UIWebView *aboutUsWebView = [[UIWebView alloc]initWithFrame:CGRectMake(0,44, 320, 460)];
        [self.view addSubview:aboutUsWebView];
        [aboutUsWebView setOpaque:NO];
        aboutUsWebView.backgroundColor = [UIColor whiteColor];
        aboutUsWebView.delegate = self;

        [aboutUsWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.ayansys.com/"]]];

       biblePlayerController = [[BiblePlayerViewController alloc]initWithNibName:@"BiblePlayerViewController" bundle:nil];

        navigationController = [[UINavigationController alloc]init];
        navigationController.view.frame = CGRectMake(0, 0, 320, 44);
        [self.view addSubview:navigationController.view];

         self.navigationController.navigationBar.tintColor=[UIColor orangeColor];

        UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(GotoBiblePlayerViewController)];          

        self.navigationItem.leftBarButtonItem = backButton;   
}
Pfitz
  • 7,336
  • 4
  • 38
  • 51
  • Possible duplicate of http://stackoverflow.com/questions/2846539/adding-back-button-to-navigation-bar – Meet Jul 03 '12 at 05:30

1 Answers1

1
[self.navigationController setNavigationBarHidden:NO animated:YES]; 

put this in either your viewDidAppear, viewDidLoad or viewWillAppear.

or this:

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
Bazinga
  • 2,456
  • 33
  • 76