iOS Development

ios – NSTextView – utilizing up/down arrows strikes paragraphs not traces

I’ve an app that runs on iOS and makes use of UITextView to show wealthy textual content, and likewise runs on Mac and makes use of NSTextView to show wealthy textual content. These are separate apps, however with a variety of shared code. In each instances, the {NS,UI}Textview is programmatically created and positioned on a canvas.

{NS,UI}TextView will wrap lengthy traces of textual content as required. Lengthy traces are known as paragraphs and have NSParagraphStyles that may be utilized throughout the entire paragraph (line spacing, head indent and many others). Every paragraph is delineated by a “n” character (or one of many Unicode equivalents). Paragraphs wrap throughout a number of traces, if required.

On iOS, when you might have a protracted paragraph protecting a number of traces… if you happen to use the down/up arrow keys, the cursor strikes up and down by traces (i.e. presumably throughout the similar paragraph), which is as you count on.

On the Mac, with the identical setup, the up/down arrow keys transfer the cursor up and down by paragraphs (i.e. a number of traces), which could be very a lot not what you count on.

I’ve hooked up movies of the 2 cursor actions so you’ll be able to see what occurs.

I exploit the identical code to create the {NS,UI}TextView, and I am unable to see why there’s a distinction.

Does anybody know what is going on on right here? I’ve not interfered with the arrow key handlers in any manner (though I do implement textViewDidChangeSelection: within the delegate, and might affirm that the choice is altering per my feedback above).

Any concepts could be most appreciated!

iOS Cursor Down in a UITextView.

iOS Cursor Down

Mac Cursor Down in an NSTextView.

Mac Cursor Down

What's your reaction?

Leave A Reply

Your email address will not be published.