Welcome to the documentation for IQMediaPickerController. This is a powerful and customizable media picker controller for iOS apps. With IQMediaPickerController, you can let your users easily select photos and videos from their device’s photo library or capture new ones using the camera. This documentation will guide you through the process of integrating and using IQMediaPickerController in your app.
Installation
To install IQMediaPickerController in your project, follow these steps:
- Open your project in Xcode.
- Add IQMediaPickerController to your project by either:
- Adding it as a dependency using CocoaPods by adding the following line to your Podfile:
- Manually downloading and including the IQMediaPickerController framework in your project.
- Import the IQMediaPickerController module wherever you need to use it in your code:
pod 'IQMediaPickerController'
import IQMediaPickerController
Basic Usage
Using IQMediaPickerController is straightforward. Here’s an example of how to present the picker controller:
// Create an instance of IQMediaPickerController
let mediaPickerController = IQMediaPickerController()
// Customize the picker controller if desired
mediaPickerController.allowsPickingMultipleItems = true
mediaPickerController.delegate = self
// Present the picker controller
self.present(mediaPickerController, animated: true, completion: nil)
Make sure to conform to the IQMediaPickerControllerDelegate and implement the necessary delegate methods to handle the selected media:
func mediaPickerController(_ controller: IQMediaPickerController, didFinishMediaWithInfo info: [Any])
func mediaPickerControllerDidCancel(_ controller: IQMediaPickerController)
Customization
IQMediaPickerController provides various customization options to fit your app’s requirements. Here are some key properties you can modify:
allowsPickingMultipleItems
: A Boolean value that determines whether the user can select multiple photos and videos at once. Defaults tofalse
.mediaType
: An enum representing the media types the picker controller should display. You can choose fromphoto
,video
, orboth
. Defaults toboth
.sourceType
: An enum representing the source type the picker controller should use to display media. You can choose fromcamera
,photoLibrary
, orboth
. Defaults toboth
.allowedVideoRecordingDuration
: A TimeInterval value that determines the maximum duration allowed for video recording. Defaults to no limit.allowedVideoRecordingFileSize
: An Int value that determines the maximum file size allowed for video recordings in bytes. Defaults to no limit.
Conclusion
Congratulations! You now have a basic understanding of how to use and customize IQMediaPickerController in your iOS app. Explore the provided delegate methods and properties to further enhance the media picking experience for your users. Enjoy!