Friday, September 30, 2022
HomeiOS Developmentios - NSTextView - utilizing up/down arrows strikes paragraphs not strains

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


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

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

On iOS, when you may have a protracted paragraph protecting a number of strains… in the event you use the down/up arrow keys, the cursor strikes up and down by strains (i.e. probably 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 strains), which may be very a lot not what you count on.

I’ve hooked up movies of the 2 cursor actions so you possibly can see what occurs.

I take advantage of the identical code to create the {NS,UI}TextView, and I can not 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 method (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!
Thx.

iOS Cursor Down in a UITextView.

iOS Cursor Down

Mac Cursor Down in an NSTextView.

Mac Cursor Down

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments