无法删除iOS 6中QLPreviewController中的导航项

时间:2013-02-28 10:38:18

标签: ios qlpreviewcontroller

我继承了QLPreviewController并使用了

[[self navigationItem] setRightBarButtonItem:nil];

但仅在iOS 5中删除了navigationItem,而不是iOS6

2 个答案:

答案 0 :(得分: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];
    }
}

答案 1 :(得分:0)

rake db:drop && rake db:create && rake db:migrate