隐藏右键n QLPreviewController吗? [英] Hide right button n QLPreviewController?

查看:175
本文介绍了隐藏右键n QLPreviewController吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中使用QLPreviewController的子类,并使用以下代码.

I am subclassing QLPreviewController in my application and using the following code.

QLPreviewControllerSubClass* preview = [[QLPreviewControllerSubClass alloc] init];
  [self presentViewController:preview
                       animated:YES
                     completion:^()
                    {
                         // do more stuff here
                     }];

我想隐藏右栏按钮.尝试过

I want to hide the right bar button .Tried

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    [self navigationItem].rightBarButtonItems = nil;
}

但是它没有隐藏.任何帮助都是有意义的

But its not hiding.Any help will be appreciable

推荐答案

我也在处理相同的问题.

I'm dealing the same problem also.

我隐藏了rightBarButton,但是当pdf的加载时间很长时可能会有一些问题.

I made the rightBarButton hidden, but may have some problem when the loading of pdf lasts for a long time.

下面是我的过程.

1.成为QLPreviewController的子类.

1.Make a sub class of QLPreviewController.

2.添加一个计时器,以在类初始化时重复将rightBarButton设置为nil.

2.Add a timer to repeats setting the rightBarButton to nil when the class init.

_hideRightBarButtonTimmer = [NSTimer scheduledTimerWithTimeInterval:0.01
                                                                 target:self
                                                               selector:@selector(hideRightButton)
                                                               userInfo:nil
                                                                repeats:YES];

3.使viewDidAppear中的计时器失效.

3.Invalidate the timer in viewDidAppear.

[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(cancelTimmer) userInfo:nil repeats:NO];

我发现在pdf文件的加载完成时,设置了rightBarButton.如果我们能够检测到事件,则解决方案将变得更加轻松和清晰.

And I found the rightBarButton is setup while the loading of pdf file is finished. If we can detect the event the solution will be much easier and clearer.

希望这会有所帮助.

这篇关于隐藏右键n QLPreviewController吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆