gpt4 book ai didi

ios - -[__NSCFString _getValue :forType:]: unrecognized selector sent to instance

转载 作者:行者123 更新时间:2023-11-29 01:41:03 26 4
gpt4 key购买 nike

NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:timeString];
UIFont *font = [UIFont fontWithName:self.txtFieldForEndTime.font.familyName size:self.txtFieldForEndTime.font.pointSize / 2];

NSDictionary *attrs = @{
NSFontAttributeName:font,
(__bridge NSString *) kCTSuperscriptAttributeName:[string substringFromIndex:string.length - 2]
};
[attString setAttributes:attrs range:[string rangeOfString:@"PM"]];

上面的代码试图对最后两个 AM/PM 字符进行 super 脚本处理。

但应用程序因声明 -[__NSCFString _getValue:forType:]: unrecognized selector sent to instance 而崩溃。

你能告诉我这段代码有什么问题吗?如果您有上标部分 NSString 的工作代码,请告诉我。

最佳答案

您可以通过减小字体的磅值来伪造上标,并使用 NSBaselineOffsetAttributeName 属性将文本向上或向下移动基线。

关于ios - -[__NSCFString _getValue :forType:]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32371122/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com