J'aimerais savoir s'il est possible d'utiliser une attributed string pour avoir la premiere lettre d'une nsstring qui s'affiche avec une autre police (taille + couleur) comme sur la capture en PJ.
// Quote
NSMutableAttributedString* str = [NSMutableAttributedString attributedStringWithString:@Every man is the architect of its own future.\n\n];
[str setFont:[UIFont boldSystemFontOfSize:24] range:NSMakeRange(0,1)]; // Bigger first letter
[str setTextColor:[UIColor greenColor] range:NSMakeRange(0,1)]; // Green first letter
// Add author in italics: we can also concat 2 attributed strings instead of applying attributes to ranges, that's another way to do it
NSMutableAttributedString* author = [NSMutableAttributedString attributedStringWithString:@Sallust];
[author setFontItalics:YES];
[str appendAttributedString:author];
Réponses
Bien sûr... Un truc de ce genre...
Oui.
De tête, à une erreur de compil'/warning près :
Vu que la première lettre semble être en gras, il peut être utile de savoir que :
Italic, Taille et Gras (notamment) sont gérés par le NSFontAttributeName.
Du coup, il faut que ta police gère ça.
Notamment si j'pense au texte en bas en italic.
Vous etes géniaux, merci
Bon, je l'admet, ma réponse était bien moins précise, mais tout de même Ali, tu faiblis ! 3 réponses avant que tu ne te réveilles !!! ;D :-*