Bonjour suite à la mise à jour Xcode en 12.4, j’ai dans un pickerview une image unicode qui ne s’affiche plus. ci joint l’image de l’écran avant et le code de la page concernée et qui permettait d’afficher cette image. si quelqu’un a une idée je suis preneur (l’unicode peut être remplacé par une image). merci
import UIKit
class SIBViewControllerMenuGeneral: UIViewController {
@IBOutlet weak var pickerViewGuide: UIPickerView!
var selectedIndex = 0
var menus:[PFMenuGeneral] = []
override func viewDidLoad() {
super.viewDidLoad()
self.pickerViewGuide.delegate = self as! UIPickerViewDelegate // EVENEMENT COMPLEXE D'INTERACTION
self.pickerViewGuide.dataSource = self as! UIPickerViewDataSource// EVENEMENT COMPLEXE DE TYPE DONNEES
// recupération des informations du menu general
PFMenuGeneral.getAllMenuGeneral { (succed, menusReceive) in
print(menusReceive)
self.menus = menusReceive!
selectedMenuGeneral = self.menus.first
self.pickerViewGuide.reloadAllComponents()
}
// Do any additional setup after loading the view.
}
}
// CREATION D4UNE EXTENSION POUR BIEN ISOLER LES FONCTION D'UN DELEGATE
extension SIBViewControllerMenuGeneral: UIPickerViewDelegate, UIPickerViewDataSource{
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return menus.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
var titlePicker = menus[row].nom!
return titlePicker
}
//
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
let title = menus[row].nom
print(title)
selectedMenuGeneral = nil
selectedPageVente = nil
selectedIndex = row
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierDecouverte && moduleDecouverteIsUnlock == false) {
selectedPageVente = menus[row].pointerPageVente
}
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierCulture && moduleCultureIsUnlock == false) {
selectedPageVente = menus[row].pointerPageVente
}
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierSport && moduleSportIsUnlock == false) {
selectedPageVente = menus[row].pointerPageVente
}
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierNature && moduleNatureIsUnlock == false) {
selectedPageVente = menus[row].pointerPageVente
}
selectedMenuGeneral = menus[row]
}
func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
var titleData = menus[row].nom!
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierDecouverte && moduleDecouverteIsUnlock == false) {
titleData += " \u{1F512}"
}
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierCulture && moduleCultureIsUnlock == false) {
titleData += " \u{1F512}"
}
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierSport && moduleSportIsUnlock == false) {
titleData += " \u{1F512}"
}
if (menus[row].pointerPageVente?.iapIdentifier == iapIdentifierNature && moduleNatureIsUnlock == false) {
titleData += " \u{1F512}"
}
let myTitle = NSAttributedString(string: titleData, attributes: [NSAttributedStringKey.font:UIFont(name: "Georgia", size: 20.0)!,NSAttributedStringKey.foregroundColor:UIColor.white])
return myTitle
}
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
var titleData = menus[row].nom!
let pickerLabel = UILabel(reuseIdentifier: titleData)
if UIDevice.current.userInterfaceIdiom == .pad {
pickerLabel.font = UIFont.systemFont(ofSize: 35)
pickerLabel.textColor = .white
pickerLabel.textAlignment = .center
pickerLabel.text = titleData
} else if UIDevice.current.userInterfaceIdiom == .phone {
pickerLabel.font = UIFont.systemFont(ofSize: 20)
pickerLabel.textColor = .white
pickerLabel.textAlignment = .center
pickerLabel.text = titleData
}
return pickerLabel
}
}