QLPreviewController在ios6中隐藏打印按钮 [英] QLPreviewController hide print button in ios6
本文介绍了QLPreviewController在ios6中隐藏打印按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何隐藏中的打印按钮QLPreviewController
IOS5
,此代码有效
QLPreviewController *previewController = [[QLPreviewController alloc] init];
previewController.dataSource = self;
previewController.delegate = self;
previewController.currentPreviewItemIndex = _fileidx;
[[self navigationController] pushViewController:previewController animated:YES];
[previewController.navigationItem setRightBarButtonItem:nil];
但是在IOS6中,它确实没有。
but in IOS6, it does`t.
推荐答案
我设法通过创建一个计时器来检查导航项并将其删除
i managed to do it by creating a timer to check for the navigation item and remove it
myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(hideRightButton:)
userInfo:nil
repeats:YES];
- (void)hideRightButton:(NSTimer *)timer {
[self inspectSubviewsForView:self.view];
}
- (void)inspectSubviewsForView:(UIView *)view
{
for (UIView *subview in view.subviews)
{
NSLog(@"class detected %@",[subview description]);
if ([subview isKindOfClass:[UINavigationBar class]])
{
UINavigationBar *bar = (UINavigationBar *)subview;
if ([[bar items] count] > 0)
{
UINavigationItem *navItem = [[bar items] objectAtIndex:0];
[navItem setRightBarButtonItem:nil];
{
}
if ([subview isKindOfClass:[UIView class]] && [[subview subviews] count] > 0)
{
[self inspectSubviewsForView:subview];
}
}
}
[self inspectSubviewsForView:subview];
}
}
这篇关于QLPreviewController在ios6中隐藏打印按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文