Set text insertion point with NSMakeRange
I am reading through some code and was wondering if I am understanding this correctly. let's assume there are 20 characters in myTextView.
NSRange range = NSMakeRange([[myTextView textStorage] length], 0);
[myTextView setSelectedRange: range];
I think this is setting the text insertion point to after character 20, right?
So would
NSRange range = NSMakeRange([0,
0);
[myTextView setSelectedRange: range];
Set the text insertion point to after char 0?
Todd
I was confused but the first element of length is 1 and the first element of range is 0 not 1.
Todd
Thanks for answering your own question, Todd. I've been on vacation this week (walking in Grand Canyon, AZ) and just back. I'm glad you're not stuck. I think you've also answered your own question about the tableView. I'll have a more careful read at that tomorrow when I'm less tired from being on the train for 24 hours. Let me know if you're stuck on anything.
How are you getting on with the book?
Did you hike to the bottom? That is a wonderful hike! So beautiful at the bottom, probably a good time of year too. I always forget when getting a length it is literal and when referring to an item it starts at 0 not 1.
I have gotten to chapter 12 of the book. At the moment I am rebuilding my download app, using RaiseMan as a starting point. My code looks alot better.
As I posted in the book section, I thought the book started out really good and then later on the descriptions kind of fizzled out a little, but still learned alot.
Todd