Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Getting a particular object from NSArrayController?
So I decided to add a searchField that can search my array and update my tableview as text is inputed into the searchField....have to say I was quite chuffed about that!
Having done that I've now instigated a problem for myself! I have a double click action on my table rows that looks like this:
As you can see I get the particular notesArray object by finding out what the selected row is in the table. Then I take the object (a string) and add it to a textView to allow the user to edit it if necessary and then replace the object.
The problem I have now is that when the table updates whilst the user is searching and then double clicks on a row, I'm still getting the object for the array at that particular index.
For example let's say the table looks like this:
Note 1
Note 2
Note 3
Note 4
Note 1, 2, 3, 4 in my array are at the relative indexes, as in Note 1 is at index 1 in my array and Note 2 is at Index 2 in my array so on and so forth. However let's say the user searches for Note 4. The table updates and now looks like this:
Note 4
If they double click on that row the textView shows Note 1 because Note 1 is the object at index 1 in my array.
So how would I get the correct index when the table updates when a user searches?
I really hope that makes sense, I guess there's probably an easier way to explain it!
Replies
- Spam
- Abuse
- Troll
0 · Off Topic Insightful Disagree Dislike Like Awesome