mwaterfall / MWPhotoBrowser

A simple iOS photo and video browser with grid view, captions and selections.
MIT License
8.75k stars 2.71k forks source link

MWPhotoBrowser crashes when embedded as childViewController #428

Open mangerlahn opened 9 years ago

mangerlahn commented 9 years ago

MWPhotoBrowser crashes when embedded as childViewController, because it always tries to speak to the navigationBar. In my case, MWPhotoBrowser is only on view on the screen.

In the performLayout method of MWPhotoBrowser.h it tries to set navigationButtons. Instead of trying to set a back button, he should check first if there are other viewControllers.

This fixed it for me:

if ([self.navigationController.viewControllers objectAtIndex:0] == self) {
// We're first on stack so show done button
...
} else if (self.navigationController.viewControllers.count != 1) {
// We're not first so show back button
...
}

Besides that, MWPhotoBrowser is working super fine!

dogvscat commented 9 years ago

My class MPBrowserViewController was Inherited from MWPhotoBrowser too,i follow your code, but it still crash.i can just preview about 20 photos.