Je veux personnaliser une méthode avec entrée de chaîne formées et retour (const char *), mais le problème est comme ci-dessous ... Quelqu'un peut-il me dire comment le résoudre? Merci. Comment personnaliser une méthode comme 'stringWithFormat'?
Répondre
-(const char *)stringWithFormat:(NSString *)format, ...
{
va_list args;
va_start(args, format);
NSString *lString = [[NSString alloc] initWithFormat:format arguments:args];
[lString autorelease];
va_end(args);
return [lString cStringUsingEncoding:NSUTF8StringEncoding];
}
Parfait, merci! – stream
@stream: Incroyable vous avez accepté, mais din't upvoted !!! Toujours upvote si vous aimez une réponse. cela stimule la personne qui donne le temps de répondre. Et en lisant vous apprenez quelque chose. :) –
+1 de mon côté à Parag. –
- 1. Comment mettre en œuvre multibleparams comme stringWithFormat
- 2. Comment créer une méthode en Objective-C qui prend comme paramètre un NSString stringWithFormat?
- 3. Objectif - C Sting mise en forme comme printf/NSString stringWithFormat
- 4. boxe de NSString stringWithFormat comme NSNumber
- 5. Comment personnaliser une méthode d'assistance Devise?
- 6. Comment personnaliser une méthode Execute de ObjectQuery?
- 7. Monotouch stringWithFormat utilisant une URL
- 8. Comment personnaliser UITextField comme ça?
- 9. comment personnaliser facebook comme bouton?
- 10. Comment localiser stringWithFormat avec% d?
- 11. Quand utiliser NSString stringWithFormat;
- 12. Comment personnaliser sélectionner comme ceci
- 13. Utilisation de « chaînes générées » (stringWithFormat) comme clés pour NSDictionary
- 14. NSMutableString stringWithFormat
- 15. NSString stringWithFormat
- 16. stringWithFormat Issue
- 17. Comment convertir "stringWithFormat" en Java?
- 18. personnaliser UILabel comme instragram
- 19. stringWithFormat et NSArray
- 20. Spinner Personnaliser comme dropbox
- 21. NSString StringWithFormat renvoie zéro?
- 22. NSString stringWithFormat est lent
- 23. Comment corriger une chaîne à l'aide de stringWithFormat
- 24. NSString stringWithFormat résultat indésirable
- 25. Utilisation de stringWithFormat: comme chemin de fichier dans le cacao
- 26. séparées par une virgule mille NSString stringWithFormat
- 27. Comment personnaliser la méthode to_json dans rails3?
- 28. NSString - stringWithFormat publié automatiquement
- 29. tableau char [NSString stringWithFormat:]
- 30. Conversion de la méthode objective c en C# stringWithFormat: @ "% @%. 0f% @"
Souhaitez-vous transmettre un nombre variable d'arguments? –
Oui. Je veux personnaliser une méthode comme [NSString stringWithFormat: <# (NSString *), ... #>]; – stream