We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm having issues trying to show the X of Y paging in the navigation bar title when the gallery initially launches.
I'm using my own custom overlay using the following code:
class CustomGalleryOverlay: INSNibLoadedView, INSPhotosOverlayViewable { @IBOutlet var navigationBar: UINavigationBar! @IBOutlet var toolBar: UIToolbar! var photosViewController: INSPhotosViewController? override init(frame: CGRect) { super.init(frame: frame) navigationBar.isTranslucent = true } required public init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } // Pass the touches down to other views override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { if let hitView = super.hitTest(point, with: event) , hitView != self { return hitView } return nil } func populateWithPhoto(_ photo: INSPhotoViewable) { if let photosViewController = photosViewController { if let index = photosViewController.dataSource.indexOfPhoto(photo) { navigationBar.topItem?.title = String(format:NSLocalizedString("%d of %d",comment:"dasdas"), index + 1, photosViewController.dataSource.numberOfPhotos) } } } func setHidden(_ hidden: Bool, animated: Bool) { if self.isHidden == hidden { return } if animated { self.isHidden = false self.alpha = hidden ? 1.0 : 0.0 UIView.animate(withDuration: 0.2, delay: 0.0, options: [.allowAnimatedContent, .allowUserInteraction], animations: { () -> Void in self.alpha = hidden ? 0.0 : 1.0 }, completion: { result in self.alpha = 1.0 self.isHidden = hidden }) } else { self.isHidden = hidden } } @IBAction func closeGallery(_ sender: UIBarButtonItem) { photosViewController?.dismiss(animated: true, completion: nil) }
However, when I launch the gallery, the X of Y paging telling you what image you're on does not appear initially until I scroll to the second image.
And if I have only one image, the paging doesn't show at all.
Can someone assist?
Thanks!
The text was updated successfully, but these errors were encountered:
@m1entus
Not sure if this is the "correct" way to do it but I resolved it by invoking populateWithPhtoto in the following didSelectItemAt:
populateWithPhtoto
didSelectItemAt
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { ... galleryPreview.overlayView = CustomGalleryOverlay(frame: CGRect.zero) galleryPreview.overlayView.populateWithPhoto(images[(indexPath as NSIndexPath).row]) .... }
Can you confirm if this is correct? Thanks
Sorry, something went wrong.
No branches or pull requests
I'm having issues trying to show the X of Y paging in the navigation bar title when the gallery initially launches.
I'm using my own custom overlay using the following code:
However, when I launch the gallery, the X of Y paging telling you what image you're on does not appear initially until I scroll to the second image.
And if I have only one image, the paging doesn't show at all.
Can someone assist?
Thanks!
The text was updated successfully, but these errors were encountered: