私の textViews の書式設定は、iOS 6 では正常に機能しましたが、iOS 7 では機能しなくなりました。これは非常に紛らわしいので、誰かがこのような簡単なことで私を助けてくれることを願っています.
textColor
私の静的な UITextView には、もともとそれとtextAlignment
プロパティの値が割り当てられていました。次に、 を作成しNSMutableAttributedString
、属性を割り当ててから、textView のattributedText
プロパティに割り当てました。配置と色は、iOS 7 では有効になりません。
どうすればこれを修正できますか? これらのプロパティが効果を発揮しない場合、なぜそれらはもう存在するのでしょうか? textView の作成は次のとおりです。
UITextView *titleView = [[UITextView alloc]initWithFrame:CGRectMake(0, 90, 1024, 150)];
titleView.textAlignment = NSTextAlignmentCenter;
titleView.textColor = [UIColor whiteColor];
NSMutableAttributedString *title = [[NSMutableAttributedString alloc]initWithString:@"Welcome"];
UIFont *font = [UIFont fontWithName:@"Avenir-Light" size:60];
[title addAttribute:NSParagraphStyleAttributeName value:font range:NSMakeRange(0, title.length)];
titleView.attributedText = title;
[self.view addSubview:titleView];