2013-02-28 56 views

回答

0

我設法通過創建一個定時器來檢查導航項目,將其取下

這裏做的是代碼:

[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]; 
    } 
} 
0
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]; 
}