変更可能とは変更できることを意味すると確信していますが、なぜこれが発生するのでしょうか。
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;
catextlayerとnsmutableattributedsringの両方がヘッダーファイルで定義されています。上記の文字列にスイッチで変更を加えてから、このコードを呼び出して、文字列が表示されているcatextlayerを更新します。
//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];
フォントを設定しようとするとクラッシュしますが、理由がわかりません。
-[NSConcreteMutableAttributedString setFont:range:]:認識されないセレクターがインスタンス0xd384420に送信されました *キャッチされない例外'NSInvalidArgumentException'が原因でアプリが終了しました、理由:'-[NSConcreteMutableAttributedString setFont:range:]:認識されないセレクターがインスタンス0xd384420に送信されました
なぜこうなった?