J'ai une variable CGImageRef et un CGRect (donc pas de pointeurs) et je dois l'ajouter à un NSDictionary. Comme un NSArray, NSDictionary-s n'accepte que des pointeurs. Comment pouvez-vous ajouter un CGImageRef ou un CGRect de toute façon?Comment ajouter un CGImageRef à un NSDictionary?
0
A
Répondre
2
CGImageRef est déjà un pointeur, mais ce n'est pas (AFAIK) un pointeur vers un objet Cocoa valide. Vous pouvez transformer un CGImage en un NSBitmapImageRep Cocoa avec [[NSBitmapImageRep alloc] initWithCGImage:someimageref]
. Et NSValue est là pour envelopper les types primitifs comme CGRect.
Questions connexes
- 1. Ajouter 2d int array à NSDictionary
- 2. Comment puis-je dessiner un contexte CGImageRef à l'écran?
- 3. Comment ajouter un nombre à un Sqlcommand.Parameters?
- 4. CGImageRef et dessin des couches
- 5. Comment dois-je construire un NSDictionary avec plusieurs clés?
- 6. Comment convertir un dictionnaire NSDictionary en dict Python?
- 7. Comment sélectionner une clé aléatoire dans un NSDictionary?
- 8. Libérer CGImage (CGImageRef)
- 9. Ajouter/ajouter un Makefile à un Makefile généré par Qt
- 10. Ajouter un UIview à un UIViewController
- 11. Ajouter un fichier à un fichier MSI
- 12. Comment ajouter une perspective à un UIImageView
- 13. Comment ajouter un mode édition à jEdit?
- 14. Comment ajouter un identifiant à l'entrée?
- 15. Comment ajouter des enfants à un LegendItem?
- 16. Comment ajouter une conjonction à un NSPredicate
- 17. comment ajouter à un objet avec innerHTML
- 18. Comment ajouter un événement à une classe
- 19. Comment ajouter un utilisateur à django-tagging
- 20. Comment ajouter MouseEvents à un AbsolutePanel?
- 21. Comment ajouter un type MIME à .htaccess?
- 22. Comment ajouter html_entity_decode à un tableau?
- 23. Comment ajouter un bouton Effacer à UITextField?
- 24. Ajouter 1 à un champ
- 25. Comment ajouter un pilote ODBC à un environnement MAMP?
- 26. Comment ajouter un attribut à un élément XmlArray (XML Serialization)?
- 27. WCF: comment ajouter un ServiceThrottlingBehavior à un service WCF?
- 28. Comment ajouter un gif animé à un bouton?
- 29. Java: comment ajouter un raccourci à un composant
- 30. Comment ajouter un type de document à un XDocument?