是否可以使用 绘制多行文本drawInRect:withAttributes
?我正在创建一个自定义的每日日历视图,将事件显示为带有标题和副标题的彩色块。如果我要写
NSMutableParagraphStyle *textStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
[textStyle setLineBreakMode:NSLineBreakByTruncatingTail];
[textStyle setAlignment:NSTextAlignmentLeft];
[[self title] drawInRect:_textRect withAttributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:FONT_SIZE], NSParagraphStyleAttributeName: textStyle}];
[[self subtitle] drawInRect:_textRect withAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:FONT_SIZE], NSParagraphStyleAttributeName: textStyle}];
那么这两行文字就会重叠。有什么办法可以在标题下方绘制副标题?