swift
1func savePhoto(controller: UIViewController, index: Int){ 2 photoManager.pickerController.didSelectAssets = { (assets: [DKAsset]) in 3 for asset in assets { 4 asset.fetchFullScreenImage(completeBlock: { (image, info) in 5 //アルバムに保存 6 setAlbum(albumTitle: self.photoManager.myAlbumTitle[index], savingImage: image!) 7 }) 8 } 9 if let _delegate = self.photoManager.delegate { 10 _delegate.PhotoSelectChanged() 11 } 12 } 13 photoManager.pickerController.deselectAll() 14 controller.present(photoManager.pickerController, animated: true) {} 15 }
この関数を実行するとphotoManager.pickerController.didSelectAssets->for asset in assets->asset.fetchFullScreenImageまで来た後、setAlbumに入らず、下のif let _delegate = self.photoManager.delegateの評価をしてからsetAlbumが実行されるのはどうしてなのかわかりません
よろしくお願いします
didSelectAssets
1pickerController.didSelectAssets 2 3The callback block is executed when user pressed the select button. 4 5Declaration 6SWIFT 7public var didSelectAssets: ((_ assets: [DKAsset]) -> Void)?
fetchFullScreenImage
1Fetch an image with the current screen size. 2 3Declaration 4 5public func fetchFullScreenImage(_ sync: Bool, completeBlock: @escaping (_ image: UIImage?, _ info: [AnyHashable: Any]?) -> Void) 6Parameters 7sync 8If true, the method blocks the calling thread until image is ready or an error occurs. 9completeBlock 10The block is executed when the image download is complete. 11
よろしくお願いします
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/09/26 05:56
2018/09/26 06:07
退会済みユーザー
2018/09/26 06:17