OceanLabs / FacebookImagePicker-iOS

A Facebook image picker providing a simple UI for a user to pick photos from a users Facebook account. It provides an image picker interface that matches the iOS SDK's UIImagePickerController.
https://www.kite.ly
MIT License
103 stars 56 forks source link

Functionality ShouldPick #14

Open szlangini opened 8 years ago

szlangini commented 8 years ago

Hey OceanLabs,

great work, really much appreciated this. I am using this in Swift2.1 though.

Can you quickly explain to me how to allow the user to just pick 1 Image each? I'll get an error using the Should function.

szlangini commented 8 years ago

found an answer myself: func facebookImagePicker(imagePicker: OLFacebookImagePickerController!, shouldSelectImage image: OLFacebookImage!) -> Bool { if imagePicker.selected == nil { return true; } else if imagePicker.selected.count == 0 { return true; } else { return false; } }

vsiniak commented 7 years ago

@szlangini, you can also dismiss the picker after selecting the first image.

- (void)facebookImagePicker:(OLFacebookImagePickerController *)imagePicker didSelectImage:(OLFacebookImage *)facebookImage {
    [self dismissViewControllerAnimated:YES completion:^{
        // process facebookImage
    }];
}