Nouveau NSAttributedString multiligne

J'ai travaillé UILabel. Mais setLineBreakMode est obsolète.
J'ai été en utilisant NSAttributedString.
mais UILabel setLineBreakMode est
Après que UILabel setNumberOfLines d'autre ne fonctionne pas.

Avant:

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(42.0f, 10.0f, 275.0f, 50.0f)];
label.text = @"XXXXXX";
memoLabel.textAlignment = UITextAlignmentLeft;
memoLabel.numberOfLines = 2;
memoLabel.lineBreakMode = UILineBreakModeTailTruncation;
memoLabel.font = [UIFont systemFontOfSize:11];
memoLabel.backgroundColor = [UIColor clearColor];

IOS 6 après:

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
paragraphStyle.alignment = NSTextAlignmentLeft;
NSAttributedString *string
    = [[NSAttributedString alloc] initWithString:text
                                  attributes:[NSDictionary
                                              dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:11],
                                              NSFontAttributeName,
                                              paragraphStyle, NSParagraphStyleAttributeName,nil]];
[paragraphStyle release];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(42.0f, 10.0f, 275.0f, 50.0f)];
label.attributedText = string;
[string relase];

Je veux être le même avant et après l'affichage.
Comment faire pour afficher plusieurs lignes?

Beaucoup de vous trouver ici. Avez-vous vu <stackoverflow.com/questions/8921858/...>?

OriginalL'auteur user1796025 | 2012-11-03