Open pawelnathan opened 9 years ago
I'm confused about how do you open for the second time? if you just dismiss, and present again, without dealloc _photoBrowser, setCurrentPhotoIndex should work. Of course, you should keep the position index after the browser dismiss and call setCurrentPhotoIndex with the position index you kept.
Hi! Thanks for your support.
In viewDidLoad I init the photoBrowser like this:
_photoBrowser = [[MWPhotoBrowser alloc] initWithDelegate:self];
// Set options
_photoBrowser.displayActionButton = YES; // Show action button to allow sharing, copying, etc (defaults to YES)
_photoBrowser.displayNavArrows = NO; // Whether to display left and right nav arrows on toolbar (defaults to NO)
_photoBrowser.displaySelectionButtons = NO; // Whether selection buttons are shown on each image (defaults to NO)
_photoBrowser.zoomPhotosToFill = YES; // Images that almost fill the screen will be initially zoomed to fill (defaults to YES)
_photoBrowser.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)
_photoBrowser.enableGrid = YES; // Whether to allow the viewing of all the photo thumbnails on a grid (defaults to YES)
_photoBrowser.startOnGrid = NO; // Whether to start on the grid of thumbnails instead of the first photo (defaults to NO)
_photoBrowser.autoPlayOnAppear = NO; // Auto-play first video
to switch to the new photo index I am doing:
[_photoBrowser setCurrentPhotoIndex:newPhotoInd];
UINavigationController *navPhotoBrowser = [[UINavigationController alloc]
initWithRootViewController:_photoBrowser];
navPhotoBrowser.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:navPhotoBrowser animated:YES completion:NULL];
This seems to work only the first time. When I call it the second time, the new photo index is ignored.
If I open it and swipe to a different photo, this is shown no matter which photo index I set in the above call.
The workaround that seems to work is to reinit the photobrowser. Is this supposed to be done this way?
Regards Werner
I'm experiencing the same issue. Also, "solved" it by re-initing the photo browser each time.
I am doing: [_photoBrowser setCurrentPhotoIndex:newPhotoInd];
On the second time, it keeps the photoIndex position of the first time. Is it possible to do this? Or do I have to dispose and reinit photoBrowser every time?
Thanks Werner