override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0{
guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else{
print("相册🙅♂️")
return
}
let picker = UIImagePickerController()
picker.allowsEditing = false
picker.sourceType = .photoLibrary
picker.delegate = self
self.present(picker, animated: true, completion: nil)
}
tableView.deselectRow(at: indexPath, animated: true)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
coverImageView.image = info[UIImagePickerControllerOriginalImage]as?UIImage
coverImageView.contentMode = .scaleAspectFill
coverImageView.clipsToBounds = true
dismiss(animated: true, completion: nil)
}