Closed SwiftPredator closed 7 years ago
Hi, @SwiftPredator! Thanks for trying out PinpointKit.
PinpointKit was designed to capture a screenshot of the window when presented, but we do allow you to override this behavior. Instead of calling pinpointKit.show(from: self)
, for example, you can pass in a second parameter, screenshot
, to specify the image that you want to display and annotate. This would look something like:
pinpointKit.show(from: self, screenshot: image)
where image
is an instance of UIImage
.
Here’s a sample view controller to get you started that allows the user to pick an image from their library and display it in PinpointKit
. You can adapt this solution to meet your needs.
import UIKit
import PinpointKit
class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
let pinpointKit = PinpointKit(feedbackRecipients: ["feedback@example.com"])
override func viewDidLoad() {
super.viewDidLoad()
// Show an image picker to let the user pick the image that will appear in PinpoinKit’s interface.
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
present(imagePickerController, animated: true)
}
// MARK: - UIImagePickerControllerDelegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
guard let image = info[UIImagePickerControllerOriginalImage] as? UIImage else { return }
// Dismiss the image picker.
picker.dismiss(animated: true) {
// Show PinpointKit and specify the image that was selected.
self.pinpointKit.show(from: self, screenshot: image)
}
}
}
Hi,
how can i select a screenshot from my library? Im using the 1.0.0 Swift 3.0 Version. When the PinPoint View opens its always the default view screen showed from the view Pinpoint opens.
Thanks.