NSMutableAttributedString Absturz auf änderung der schriftart?

Ich bin sicher, veränderlich bedeutet, es kann geändert werden, also warum ist das passiert?

attrString = [[NSMutableAttributedString alloc] initWithString:@"Tip 1: Aisle Management The most obvious step – although one that still has not been taken by a disconcerting number of organisations – is to configure cabinets in hot and cold aisles. If you haven’t got your racks into cold and hot aisle configurations, we can advise ways in which you can achieve improved airflow performance."];

        [attrString setFont:[UIFont systemFontOfSize:20] range:NSMakeRange(0, 23)];
        [attrString setFont:[UIFont systemFontOfSize:15] range:NSMakeRange(24, 325)];
        [attrString setTextColor:[UIColor blackColor] range:NSMakeRange(0,184)];
        [attrString setTextColor:[UIColor blueColor] range:NSMakeRange(185,325)];
        break;

Meine beiden catextlayer und meine nsmutableattributedsring sind definiert in meine header-Datei. Ich mache die änderungen an meinem string vor in einem switch, dann rufen Sie diesen code zum aktualisieren der catextlayer der string wird gezeigt in:

//updates catext layer
TextLayer = [CATextLayer layer];

TextLayer.bounds = CGRectMake(0.0f, 0.0f, 245.0f, 290.0f);
TextLayer.string = attrString;
TextLayer.position = CGPointMake(162.0, 250.0f);
TextLayer.wrapped = YES;

[self.view.layer addSublayer:TextLayer];

Stürzt es ab, wenn es versucht, um die schriftart, aber ich kann nicht herausfinden, warum?

-[NSConcreteMutableAttributedString setFont:range:]: unrecognized selector geschickt Instanz 0xd384420
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableAttributedString setFont:range:]: unrecognized selector geschickt Instanz 0xd384420'

Warum ist das passiert?

Hier finden Sie einige Kostenlose code veranschaulicht die Verwendung von strings zugeschrieben: github.com/artmayes167/Attribute

InformationsquelleAutor dev6546 | 2012-09-20

Schreibe einen Kommentar