Skip to content
New issue

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

func photoBrowser(_ photoBrowser: MWPhotoBrowser!, photoAt index: UInt) -> MWPhotoProtocol! returns Nil #640

Open
MuhammadNayabButt opened this issue Aug 20, 2018 · 0 comments

Comments

@MuhammadNayabButt
Copy link

MuhammadNayabButt commented Aug 20, 2018

I have created simple browser with these 2 images
let image1 = MWPhoto.init(image: UIImage.init(named: "home1"))
let image2 = MWPhoto.init(image: UIImage.init(named: "home2"))

I created an array and have same images and the total size of array is 8.
When I scroll through images at times I got blank Screen but coming back again the image can be displayed.

The images are not being downloaded from url they are simply stored in application. The index is within range. More importantly going back and forth the image can be seen easily.
`
var photos : [MWPhoto]?
let image1 = MWPhoto.init(image: UIImage.init(named: "home1"))
let image2 = MWPhoto.init(image: UIImage.init(named: "home2"))
photos = [image1, image2,image1, image2,image1, image2,image1, image2] as? [MWPhoto]

let browser = MWPhotoBrowser.init(delegate: self)
browser?.displayActionButton = false; // Show action button to allow sharing, copying, etc (defaults to YES)
browser?.displayNavArrows = false; // Whether to display left and right nav arrows on toolbar (defaults to NO)
browser?.displaySelectionButtons = true; // Whether selection buttons are shown on each image (defaults to NO)
browser?.zoomPhotosToFill = true; // Images that almost fill the screen will be initially zoomed to fill (defaults to YES)
browser?.alwaysShowControls = false; // Allows to control whether the bars and controls are always visible or whether they fade away to show the photo full (defaults to NO)
browser?.enableGrid = false; // Whether to allow the viewing of all the photo thumbnails on a grid (defaults to YES)
browser?.startOnGrid = true; // Whether to start on the grid of thumbnails instead of the first photo (defaults to NO)
browser?.autoPlayOnAppear = false; // Auto-play first video
browser?.setCurrentPhotoIndex(1)
self.navigationController?.pushViewController(browser!, animated: true)

func numberOfPhotos(in photoBrowser: MWPhotoBrowser!) -> UInt {
return UInt(photos!.count)
}

func photoBrowser(_ photoBrowser: MWPhotoBrowser!, photoAt index: UInt) -> MWPhotoProtocol! {
let photo = self.photos![Int(index)] as! MWPhoto
return photo
// return self.photos![Int(index)]
}
`

screen shot 2018-08-20 at 11 58 45 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant