简体   繁体   中英

NSParagraphStyle iOS - How to detect Blocks and Lists?

Ive got an NSParagraphStyle object that when inspected using NSLog, contains Lists and Blocks, however there appears to be absolutely no way to access them. Using OS XI create documents and transfer them over to iOS in a text view with lists and tables can successfully recreated and show up in NSLog. However NSParagraphStyle has no methods or properties to access them, can anybody help? D:

Declaration

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

link

But, looks like there is no way to access them in iOS without introspection, as their declaration is not included to UIKit.

if ([paragraph respondsToSelector:@selector(textLists)])
  NSArray* lists = [paragraph performSelector:@selector(textLists)];
if let textLists = paragraphStyle.value(forKey: "textLists") as? NSArray {
  if let item = textLists.firstObject as? NSObject {
    print(item.description)
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM