StickerSelectionController
@available(iOS 9.0, *)
@objcMembers
@objc(PESDKStickerSelectionController)
open class StickerSelectionController : ViewController
extension StickerSelectionController: UICollectionViewDelegate
extension StickerSelectionController: UICollectionViewDataSource
extension StickerSelectionController: UICollectionViewDataSourcePrefetching
A StickerSelectionController
displays multiple Sticker
s and allows selection of a sticker.
-
The collection view that displays the
Sticker
s.Declaration
Swift
open private(set) lazy var collectionView: UICollectionView = { let flowLayout = UICollectionViewFlowLayout() flowLayout.itemSize = self.stickerPreviewSize flowLayout.minimumLineSpacing = 30 flowLayout.minimumInteritemSpacing = 20 flowLayout.sectionInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20) let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout) collectionView.delegate = self collectionView.dataSource = self collectionView.backgroundColor = UIColor.clear collectionView.accessibilityIdentifier = "pesdk_sticker_accessibility_stickerSelection" if #available(iOS 11.0, *) { collectionView.contentInsetAdjustmentBehavior = .always } if #available(iOS 10.0, *) { collectionView.prefetchDataSource = self } return collectionView }()
-
The gradient view that is added to the collection view for a fade effect.
Declaration
Swift
open private(set) lazy var gradientView: GradientView = { let gradientView = GradientView(topColor: UIColor.clear, bottomColor: UIColor.black.withAlphaComponent(0.3)) gradientView.translatesAutoresizingMaskIntoConstraints = false return gradientView }()
-
The visual effect view in the background of the collection view.
Declaration
Swift
open private(set) lazy var visualEffectView: UIVisualEffectView { get set }
-
The size of the stickers in the collection view.
Declaration
Swift
open var stickerPreviewSize: CGSize { get set }
-
The stickers which should be displayed.
Declaration
Swift
open var stickers: [Sticker] { get set }
-
An object that acts as the delegate.
Declaration
Swift
open weak var delegate: StickerSelectionControllerDelegate?
-
A closure to configure the cell of each sticker.
Declaration
Swift
open var cellConfigurationClosure: ((StickerCollectionViewCell, Sticker) -> Void)?
-
A closure that is called when a sticker was selected.
Declaration
Swift
open var stickerAddedClosure: ((Sticker) -> Void)?
-
The
AssetManager
that this view controller can use to set and get assets.Declaration
Swift
open var assetManager: AssetManager?