How to add table view section header with subscripts?

后端 未结 2 941
自闭症患者
自闭症患者 2020-12-18 16:02

In my app, I have a table view that I have managed so far with storyboards (I have added sections:rows:cells, etc.. all via storyboards), the only change I have made program

2条回答
  •  抹茶落季
    2020-12-18 16:33

    One simple solution is to use the Unicode subscript range, U+2080 through U+2089. Example: 2 H₂ + O₂ -> 2 H₂O.

    You can type one of these characters by using the Unicode Hex Input keyboard layout, holding Option, and typing the hex digits (e.g. hold option and type “2080” for “₀”).

    Given a single digit, you can format it into a string as a subscript like this:

    static const unichar kSubscriptZero = 0x2080;
    int numberOfHydrogens = 2;
    NSString *water = [NSString stringWithFormat:@"H%CO",
        kSubscriptZero + numberOfHydrogens];
    

    http://www.unicode.org/charts/PDF/U2070.pdf

提交回复
热议问题