Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9220431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:20:48+00:00 2026-06-18T03:20:48+00:00

How do we implement selectionRectsForRange: from UITextInput Protocol ? Has anybody figured out this

  • 0

How do we implement selectionRectsForRange: from UITextInput Protocol ?
Has anybody figured out this one?
Is it just very dependent upon specific use-case needs? Or is there something in the frameworks that will call this method?

To silence the compiler it is of course appropriate to stub out the method, but will returning nil or an empty NSArray cause any harm?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:20:49+00:00Added an answer on June 18, 2026 at 3:20 am

    According to session 220 at WWDC12 this method was added to support subclassing of UITextView where the implementation renders its own text. Sadly their sample code from that session isn’t available, would love to peek at it to see if I’ve missed anything in my implementation.

    It’s fairly similar to how you’d implement -firstRectForRange: except you’d return all rects which covers the current selection.

    Furthermore you’d have to subclass UITextSelectionRect (it’s an abstract class like UITextPosition/UITextRange) which you’d return an array of from this method. Make sure to calculate the containsStart and containsEnd properties correctly and only return YES for one of each once across all the selection rects you return. These properties are used by UITextView to decide on where to place the selection resize “paddles”.

    Returning an empty array (or nil I suppose) would indicate that UITextView shouldn’t draw any selection rects for the current selection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To implement a subscriptable object is easy, just implement __getitem__ in this object's class
Implement a link back to a search result page from one of its clicked
Implement an algorithm to determine if a string has all unique characters. What if
I implement very big script logic using jquery plugin at caret(http://code.google.com/p/jquery-at-caret/), but now when
To implement a callback function from the native code to Java code, I have
I implement a reference counting schema and for this i need interlock facilities but
I should implement periodically popup form at other form. This popup form isn't common
I implement this interleave method in java but it doesn't work properly. Where is
To implement my splash screen for my app, I'm starting a thread from main
I need to implement operations with matrices and size of matrix has to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.