我收到了弃用方法的消息。
代码行是这一行:
[string drawInRect:drawArea withFont:uifont lineBreakMode:linebreaks[lineBreakMode] alignment:alignments[hAlignment]];
所以我想用这段代码替换它:
NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
paragraphStyle.alignment = NSTextAlignmentCenter;
NSDictionary *attributes = @{ NSFontAttributeName: uifont,
NSParagraphStyleAttributeName: paragraphStyle};
[string drawInRect:drawArea withAttributes:attributes];
更换后,此处不再显示警告。但是,我的所有文字都是看不见的。例如,我有一个不可见的文本“选项”(但我仍然可以点击它)。
有人可以帮忙吗?
方面