0
我子類QLPreviewController和使用不能在IOS 6除去導航項目在QLPreviewController
[[自navigationItem] setRightBarButtonItem:無];
但navigationItem僅在iOS 5中,不iOS6的
刪除我子類QLPreviewController和使用不能在IOS 6除去導航項目在QLPreviewController
[[自navigationItem] setRightBarButtonItem:無];
但navigationItem僅在iOS 5中,不iOS6的
刪除我設法通過創建一個定時器來檢查導航項目,將其取下
這裏做的是代碼:
[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];
}
}
Simple solution for this is add one dummy view to current viewController and Add QLPreviewController.view to dummy view .
previewController = [[QLPreviewController alloc] init];
previewController.dataSource = self;
previewController.delegate = self;
previewController.currentPreviewItemIndex = 0;
[self.ContentView addSubview:previewController.view];
- (IBAction)removeQPView:(id)sender {
[previewController.view removeFromSuperview];
}