I decided to go a step further and do this in a very Mac-Like way. By this I mean that according to the HIG, when a row is NOT selected, the delete button should be greyed out (not selectable at all.) At first, I did like others did and simply checked to see if itemTableView.selectedRow >0 0 to avoid getting an error in deleting when nothing was selected. I then decided that I’d prefer to simply have delete not even active if no row was selected.
I implemented it by unselecting State:Enabled in the Interface Builder, so when TahDoodle launches, delete is greyed out. Then, I created a new IBAction: - (IBAction)selectArow:(id)sender; which I wired up my TableView. Now, when I click on the TableView, I do the check of itemTableView.selectedRow (or [itemTableView selectedRow] to keep the boss-man happy and now it works! I’m still having an issue with when I actually double click to edit, so I still have to make the check in the delete to make sure I’m not trying to delete while editing.
Trying to figure this one out. Aaron (or anyone, really, who knows), what is the PREFERRED method of activating/deactivating the delete button? There are many containers within containers in the TableView, so I’m not sure if I’m doing it the best way or not.
Still need to do the error stuff, then on to the next chapter.
This is a GREAT book! I’m learning a lot and feeling comfortable in exploring on my own.
Thanks again, Aaron and all the “Big Nerds” for a great resource!