Ios7 iOS::导航栏在iOS中不显示

Ios7 iOS::导航栏在iOS中不显示,ios7,ios8,xcode6,uinavigationbar,Ios7,Ios8,Xcode6,Uinavigationbar,在我的应用程序中,我添加了一个新的控制器,xib文件。我有一个显示一些html数据的web视图。现在的问题是,它没有在屏幕的任何地方显示导航栏,而是在其中显示web视图数据。我可以在xib文件中看到导航栏。下面是.m文件中的代码 #import "TechTermViewController.h" #import "PictureViewController.h" @implementation TechTermViewController @synthesize myde

在我的应用程序中,我添加了一个新的控制器,xib文件。我有一个显示一些html数据的web视图。现在的问题是,它没有在屏幕的任何地方显示导航栏,而是在其中显示web视图数据。我可以在xib文件中看到导航栏。下面是.m文件中的代码

 #import "TechTermViewController.h"
    #import "PictureViewController.h"

    @implementation TechTermViewController

@synthesize mydef;
@synthesize defhtml;
@synthesize appDelegate;
@synthesize myWebView;
@synthesize randomObject;
@synthesize preferences;



- (void)loadView {

    // 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 -= 0.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];


    [self loadDefHTML:YES];
    //[[self navigationController] setNavigationBarHidden:NO animated:YES];
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

    [self loadDefHTML:YES];

    //[[self navigationController] setNavigationBarHidden:NO animated:YES];

}


//make it happen
- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    [self loadDefHTML:YES];

    //[[self navigationController] setNavigationBarHidden:NO animated:YES];
}

//Remove the toolbar if we are disappearing
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [myWebView stopLoading];
}

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}




- (IBAction) doDone:(id)sender {
    if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:) ] ) {
        [self dismissViewControllerAnimated:YES completion:nil];
    }
    else {
        [[self parentViewController] dismissModalViewControllerAnimated:YES];
    }
}
XIB::


有什么想法吗?

问题是关于网络视图的出口。未将其设置为文件的所有者。在定义Outlet和删除loadview方法后,该方法起作用。

如果删除loadview方法,则会显示导航栏,但不会显示web视图数据……为什么会这样?myWebView.scalesPageToFit=YES;检查一下,也许这就是原因。