手动显示PHPickerViewController时如何显示当前选择的照片?

时间:2020-09-28 20:45:40

标签: ios swift ios14 photokit phpickerviewcontroller

在手动显示PHPickerViewController时是否可以显示用户当前的照片选择?例如,使用以下代码时,选择器不会显示用户当前选择的任何照片。

 var pickerConfig = PHPickerConfiguration()
 pickerConfig.selectionLimit = 0
 pickerConfig.filter = .any(of: [.images])
            
 let imagePicker = PHPickerViewController(configuration: pickerConfig)
 imagePicker.delegate = self

 // When presented, the user's current selected photos are empty, nothing is selected
 viewController.present(imagePicker, animated: true)

但是,如果我使用Apple内置的presentLimitedLibraryPicker功能,它会显示用户当前的照片选择:

// This does show the user's current selections
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from controller: self)

是否有一种无需使用presentLimitedLibraryPicker即可获得此行为的方法?

0 个答案:

没有答案