BBCodeString 是一个简单的库,它使您能够从 BB 代码字符串中创建 NSAttributedString 对象。
使用示例
NSString *bbCode = @"[user id=\"42\"]Mary Jones[/user] sent file [file id=\"23\"]Report.pdf[/file].";
BBCodeString *bbCodeString = [[BBCodeString alloc] initWithBBCode:bbCode andLayoutProvider:self];
NSAttributedString *myString = bbCodeString.attributedString;
You can simply set visual attributes for each BB code element by setting layout provider.
要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install
BBCodeString 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "BBCodeString"
Miha Rataj, [email protected]
BBCodeString 根据 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。