0

我在我的应用程序中使用 MWPhotoBrowser 库。在 iOS 8 到来之前,我正在展示照片、字幕和一切正常工作。

我的问题是;

我可以在 iOS 7 中看到我的导航栏,但在 iOS 8 中它消失了,我无法返回。我检查了 gitHub 但我找不到任何东西。你有什么主意吗?

- (void)viewPhotoBrowser{

    self.photos = [NSMutableArray array];

    for (Images *image in self.browserImages) {
        [self.photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:image.image]]];
    }

    // Create & present browser
    self.browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
    // Set options
    self.browser.displayActionButton = YES; // Show action button to allow sharing, copying, etc (defaults to YES)
    self.browser.displayNavArrows = NO; // Whether to display left and right nav arrows on toolbar (defaults to NO)
    self.browser.displaySelectionButtons = NO; // Whether selection buttons are shown on each image (defaults to NO)
    self.browser.zoomPhotosToFill = YES; // Images that almost fill the screen will be initially zoomed to fill (defaults to YES)
    self.browser.alwaysShowControls = NO; // Allows to control whether the bars and controls are always visible or whether they fade away to show the photo full (defaults to NO)
    self.browser.enableGrid = YES; // Whether to allow the viewing of all the photo thumbnails on a grid (defaults to YES)
    self.browser.startOnGrid = NO; // Whether to start on the grid of thumbnails instead of the first photo (defaults to NO)
    self.browser.wantsFullScreenLayout = NO; // iOS 5 & 6 only: Decide if you want the photo browser full screen, i.e. whether the status bar is affected (defaults to YES)

    [self.browser setCurrentPhotoIndex:0]; // Example: allows second image to be presented first

    // Manipulate
    [self.browser showNextPhotoAnimated:YES];
    [self.browser showPreviousPhotoAnimated:YES];

    [self.browser.view setFrame:CGRectMake(0, -20, self.browser.view.frame.size.width, self.browser.view.frame.size.height)];
    [self.view addSubview:self.browser.view];
    [self.navigationController pushViewController:self.browser animated:YES];
}
4

1 回答 1

1

您必须取消注释该行:

[self.view addSubview:self.browser.view];

此行将导致: MWPhotoBrowser 开始/结束外观转换的不平衡调用。

您将控制器的视图添加到您的视图中,然后立即将控制器推送到导航堆栈上。

于 2014-10-01T02:53:25.403 回答