Я новичок в программировании на ios. проблема, с которой я сталкиваюсь, заключается в том, что я установил панель инструментов в своем файле xib, но после запуска приложения панель инструментов не отображается. я добавил эту строку ниже как в функцию viewDidLoad, так и в класс delegate.m, но панель инструментов все еще не отображается
self.navigationController.toolbarHidden = NO;
вот мой код
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [userDefaults objectForKey:@"AppleLanguages"];
EPubViewController *epubView = [[EPubViewController alloc] init];
[epubView loadEpub:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"AtoZbook" ofType:@"epub"]]];
self.navigationController = [[UINavigationController alloc]initWithRootViewController:epubView];
self.navigationController.toolbarHidden = NO;
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
EPubViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationController.toolbarHidden = NO;
loadingIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
loadingIndicator.center = CGPointMake(toolbar.frame.size.width/2 ,toolbar.frame.size.height/2);
[loadingIndicator startAnimating];
toolbar.alpha = 0.8;
[self.toolbar addSubview:loadingIndicator];
[webView setDelegate:self];
UIScrollView* sv = nil;
for (UIView* v in webView.subviews) {
if([v isKindOfClass:[UIScrollView class]]){
sv = (UIScrollView*) v;
sv.scrollEnabled = NO;
sv.bounces = NO;
}
}
currentTextSize = 100;
//Webview
UISwipeGestureRecognizer* rightSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gotoNextPage)] ;
[rightSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionLeft];
UISwipeGestureRecognizer* leftSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPrevPage)] ;
[leftSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionRight];
[webView addGestureRecognizer:rightSwipeRecognizer];
[webView addGestureRecognizer:leftSwipeRecognizer];
[self performSelector:@selector(stratRolling)];
}
UIToolbar
? Вы обращаетесь к панели инструментов навигационного контроллера VC. Это панель инструментов, на которую вы хотели сослаться? - person Aaron   schedule 15.03.2014