Search code examples
iosobjective-cios8uinavigationbarmwphotobrowser

MWPhotoBrowser - Navigation Bar disappears in iOS 8


I'm using the MWPhotoBrowser library in my app. I'm showing photos, captions and everything works perfectly until the iOS 8 comes.

My problem is;

I can see my navigation bar in iOS 7 but in iOS 8 it disappears and I can't return back. I check gitHub but I couldn't find a thing. Do you have any idea?

- (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];
}

Solution

  • You have to uncomment the line:

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

    this line will cause: Unbalanced calls to begin/end appearance transitions for MWPhotoBrowser.

    You added the controller's view to your view, and then immediately push the controller onto the navigation stack.