[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fPB8ErbCQNCYq04seZseZRl8iHYIVmOv7ozekrXpiglI":3},{"code":4,"message":5,"data":6},200,"成功",{"id":7,"createdAt":8,"title":9,"content":10,"summary":11,"image":12,"uid":13,"user":14,"categoryId":21,"category":22,"subCategoryId":24,"subCategory":25,"comments":27,"status":17,"reason":12,"notice":12,"visitCount":28,"commentCount":29,"keywords":30},29,"2024-01-29T14:31:41.495Z","iOS中固定宽度下的字符串，每行子字符串","注意 - 发现一个问题\n如果给NSMutableAttributedString赋值了NSParagraph后，会截取不准子字符串.\n\n```xxx.m\n#import \"NSString+Lines.h\"\n#import \u003CCoreText/CoreText.h>\n\n@implementation NSString (Lines)\n\n- (NSArray *)getSeparatedLinesWithFont:(UIFont *)font width:(CGFloat)width {\n    CTFontRef myFont = CTFontCreateWithName((__bridge CFStringRef)([font fontName]), [font pointSize], NULL);\n    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:self];\n    [attStr addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)myFont range:NSMakeRange(0, attStr.length)];\n    \n    CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)attStr);\n    \n    CGMutablePathRef path = CGPathCreateMutable();\n    CGPathAddRect(path, NULL, CGRectMake(0, 0, width, 100000));\n    \n    CTFrameRef frame = CTFramesetterCreateFrame(frameSetter, CFRangeMake(0, 0), path, NULL);\n    \n    NSArray *lines = (__bridge NSArray *)CTFrameGetLines(frame);\n    NSMutableArray *linesArray = [[NSMutableArray alloc]init];\n    \n    for (id line in lines)\n    {\n        CTLineRef lineRef = (__bridge CTLineRef )line;\n        CFRange lineRange = CTLineGetStringRange(lineRef);\n        NSRange range = NSMakeRange(lineRange.location, lineRange.length);\n        \n        NSString *lineString = [self substringWithRange:range];\n        [linesArray addObject:lineString];\n    }\n    return (NSArray *)linesArray;\n\n}\n\n@end\n\n\n```\n","在iOS中如果字符串显示的label组件固定宽度，那么每行的字符串该如何获取呢","",499668042977349,{"phone":15,"userId":13,"nickName":16,"vipType":17,"avatar":18,"sign":19,"createdAt":20},"13121171998","全栈老韩",1,"https://image.xinwei.ltd/images/IMG_5430.JPG","全栈工程师，擅长iOS App开发、前端（vue、react、nuxt、小程序&Taro）开发、Flutter、React Native、后端（midwayjs、golang、express、koa）开发、docker容器、seo优化等。","2024-01-01T16:14:30.305Z",2,{"id":21,"name":23},"IT技术",3,{"id":24,"name":26,"parentId":21},"iOS",[],268,0,"ios,label,ios label,iOS字符串,label宽度"]