NSParagraphStyle iOS - 如何检测Blocks和Lists?

问题描述 投票:4回答:2

我有一个NSParagraphStyle对象,当使用NSLog检查时,它包含了列表和块,但似乎完全没有办法访问它们。 我在OS X上创建文档,并将其转移到iOS上,在文本视图中,列表和表格可以成功地重新创建,并显示在NSLog中。 然而NSParagraphStyle没有任何方法或属性来访问它们,有人能帮忙吗?D:

ios list block
2个回答
2
投票

声明

NSArray *textLists @property(readonly, copy) NSArray *textBlocks @property(readonly, copy) NSArray *textBlocks

联系

但是,似乎没有办法在这里访问它们。iOS 不反省,因为他们的声明不包括在UIKit中。

if ([paragraph respondsToSelector:@selector(textLists)])
  NSArray* lists = [paragraph performSelector:@selector(textLists)];

0
投票
if let textLists = paragraphStyle.value(forKey: "textLists") as? NSArray {
  if let item = textLists.firstObject as? NSObject {
    print(item.description)
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.