我是iPhone新手。我有一个小小的疑问,就是我创建了一个项目,因为当我点击它时,我会放置一个按钮UIWebView
UIView
我想要一个带有后退按钮的导航栏如何可能为此,我写了一些代码,但在这里我无法创建后退按钮。如果有人知道这个,请帮帮我...
我为此编写了以下代码
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;
}
答案 0 :(得分:1)
[self.navigationController setNavigationBarHidden:NO animated:YES];
将其放入viewDidAppear
,viewDidLoad
或viewWillAppear
。
或者这个:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;