В моем приложении я добавил один новый контроллер, xib-файлы. У меня есть веб-представление, которое показывает некоторые html-данные. теперь проблема заключается в том, что он не показывает панель навигации в любом месте экрана, но в ней отображаются данные веб-просмотра. И я вижу панель навигации в файле xib. Ниже приведен код в .m файл ..iOS :: панель навигации не отображается в iOS
#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 ::
Любая идея?
Если я удаляю метод loadview, тогда он показывает панель навигации, но не данные веб-представления .... почему так? – Anjali
myWebView.scalesPageToFit = ДА; проверьте, что, возможно, это причина. –