I installed this package https://github.com/hyperoslo/Lightbox ,but I do not know how to pass the index of my collectionView to display the desired picture , not the first one
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let controller = LightboxController(images: imagess)
controller.pageDelegate = self as? LightboxControllerPageDelegate
controller.dismissalDelegate = self as? LightboxControllerDismissalDelegate
controller.dynamicBackground = true
present(controller, animated: true, completion: nil)
}
In this case, I can change pictures but the first one always appears
I seem to have read everything but I did not find this important detail.
If i do like this :
let controller = LightboxController(images: [imagess[indexPath.row]])
I can only view one picture with the desired index but cannot change picture in gallery
Help pls :-)
You'll have to set start index to see the current image;
so try this;
let controller = LightboxController(images: imagess, startIndex:indexPath.row)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.