Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS-工具栏未显示在顶部_Ios_Iphone_Objective C_Uinavigationitem_Epub - Fatal编程技术网

IOS-工具栏未显示在顶部

IOS-工具栏未显示在顶部,ios,iphone,objective-c,uinavigationitem,epub,Ios,Iphone,Objective C,Uinavigationitem,Epub,我也问过这个问题,但我没有得到任何答案。所以我在这里再次问,并给出了完整的解释 我从下载了EPub阅读器库。当我运行这个库时,首先是一个表视图,其中包含四行,它们的值为EPUB、PDF等,然后单击“EPUB”行 书本已成功显示在顶部工具栏中。因为我必须先在start中加载书籍,而不是显示工具栏,所以我对代码做了一些更改。从DidSelectRowatineXpath复制了一些代码,并将该代码添加到delegate.m中。所以现在的问题是,book已成功加载,但工具栏未显示 这是我的密码 - (B

我也问过这个问题,但我没有得到任何答案。所以我在这里再次问,并给出了完整的解释

我从下载了EPub阅读器库。当我运行这个库时,首先是一个表视图,其中包含四行,它们的值为EPUB、PDF等,然后单击“EPUB”行 书本已成功显示在顶部工具栏中。因为我必须先在start中加载书籍,而不是显示工具栏,所以我对代码做了一些更改。从DidSelectRowatineXpath复制了一些代码,并将该代码添加到delegate.m中。所以现在的问题是,book已成功加载,但工具栏未显示

这是我的密码

- (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.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;
}
加载epubView的代码位于原始库的RootViewController.m中

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    switch (indexPath.row) {
        //TXT
        case 0:{
           //txt
            
        }
            break;
        //PDF
        case 1:{
             //PDF
        }
            break;
        //EPUB
        case 2:{
            epubView = [[EPubViewController alloc] init];
            [epubView loadEpub:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"The Chessmen of Mars" ofType:@"epub"]]];
            epubView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
            [self presentModalViewController:epubView animated:YES];
            [epubView release];
        }
            break;
        case 3:{
           //another book
        }
            break;
            
        default:
            break;
    }
   
    
}
以下是我对EpubViewController的查看方法

- (void)viewDidLoad {
    [super viewDidLoad];

    


    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)];
}
以下是图片


我想再次指出,当我从
案例2中显示epubViewController时,工具栏工作正常。我的意思是,如果我必须首先显示表视图,请单击该行。

您的工具栏隐藏为导航栏,因为导航栏始终位于顶部。您可以将工具栏添加为导航栏的子视图。我不确定它是否在顶部将工作,虽然最好的方法是使用导航栏和添加项目,它像左键右键和标题的东西,或者你可以添加一个视图作为导航栏的子视图,我已经做了之前的示例代码

navBar=self.navigationController.navigationBar;


    [navBar addSubview:statusBar];
    statusBar.frame=f;

    self.navigationController.navigationBar.translucent = YES;

这里的statusBar是一个视图,它的设置与工具栏的大小相同。

没问题,但请确保在进入下一页时隐藏此视图,因为它在每一页上都保持不变。如果你需要更多的帮助,请与我联系。谢谢,但我没有得到你的帮助。为什么我必须隐藏工具栏?我将如何与您联系?你能给我你的skype或电子邮件吗?