我有一条已弃用方法的消息。
代码行是这一行:
[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];
替换后,警告不再存在。但是,我所有的文字都是不可见的。例如,我有一个不可见的文本“选项”(但我仍然可以单击它)。
有人可以帮忙吗?
看待