Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Core Text FrameworkでNSAttributedStringを使用しているときに、ビューのタップ位置の下にあるテキストの属性(各文に固有の属性があるNSAttributedString)を見つけるにはどうすればよいですか?
テキスト ビューではなく Core Text を直接使用しますか? 私はあなたが持っていると仮定しますCTFrameRef。CTFrameGetLines()およびを使用して、線と線の原点を取得できますCTFrameGetLineOrigins()。原点に基づいて正しい行を見つけ、それを使用CTLineGetStringIndexForPosition()して文字列インデックスを取得します。
CTFrameRef
CTFrameGetLines()
CTFrameGetLineOrigins()
CTLineGetStringIndexForPosition()