iOS ::导航栏不会出现

时间:2015-06-24 12:06:40

标签: ios uinavigationbar

我正在开发一个iOS应用程序,并使用Web视图在其中显示一些HTML数据。 我在其中添加了导航栏。用于显示之前的导航栏。  但是,当我添加下面的代码时,它停止显示它。

// the base view for this view controller
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor whiteColor];

// important for view orientation rotation
contentView.autoresizesSubviews = YES;
contentView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.view = contentView;
[contentView release];

//Initialize the WebView -----------------------------------------------------------
CGRect webFrame = [[UIScreen mainScreen] applicationFrame];
   // webFrame.origin.y += kTopMargin + 5.0;    // leave from the URL input field and its label
//webFrame.origin.y -= 20.0;
myWebView = [[UIWebView alloc] initWithFrame:webFrame];
//myWebView.backgroundColor = [UIColor blackColor];
myWebView.backgroundColor = [UIColor whiteColor];
myWebView.scalesPageToFit = YES;
myWebView.detectsPhoneNumbers = NO;
//myWebView.dataDetectorTypes = UIDataDetectorTypeLink;
myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
myWebView.delegate = self;
[self.view addSubview: myWebView]; 

任何帮助将不胜感激....

1 个答案:

答案 0 :(得分:4)

在控制器的viewDidLoad中编写此代码。

[self.navigationController setNavigationBarHidden:NO];

您的代码完美地处理了我的项目。