Welcome, Guest
Username Password: Remember me

Delete Button in Detail View Controller
(1 viewing) (1) Guest

TOPIC: Delete Button in Detail View Controller

Delete Button in Detail View Controller 1 year, 7 months ago #1

Hi All,

First off, I have been asking quite a few questions lately but I really do appreciate the excellent support being given.

Hopefully this one will be fairly straight-forward. I have an STV which lists objects within a Core Data entity (all of the table cells are automatically generated). As per usual, a table view cell can be tapped and the detail editing view appears allowing that row to be modified.

For UI consistency and space reasons, there is no room for an Edit button in the main STV for users to tap and see the inline delete buttons to remove rows (objects) from the STV (Core Data entity). Therefore, I have added a Delete button as the tableFooterView on the detail view controller, much like the iPhone Contacts.app. I have got the button wired-up to a selector on the main UITableViewController (i.e. the same class that initialises the STV) but I cannot figure out what code I should write to delete the managed object and then reload the main table view so that the row is removed.

Making things more complicated is that whenever the detail view controller is popped from the navigation controller it appears to do an auto-save, so even with my hackish ways of deleting the managed object, and programatically popping the view off the navigiation controller, there are major problems during the pop and save operation (usually a crash of the app).

Any help would be much appreciated

Thanks,
Matthew
  • skoota
  • OFFLINE
  • Expert Boarder
  • Posts: 89
  • Karma: 2

Re: Delete Button in Detail View Controller 1 year, 7 months ago #2

Thanks a lot Matthew, please always feel free to ask what you want

I think what we need to do to solve your problem is expose all the methods that STV uses when the end user interacts with it, and have them accessible directly to you. This way you'll be able to initiate adding and deleting items right from code, just as if the end user has initiated them.

What time frame are you bound with? Is about one week ok with you? Thanks!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72

Re: Delete Button in Detail View Controller 1 year, 7 months ago #3

Hi Tarek,

That would be fantastic - around one week would be fine. Thanks again for all your help!

Best wishes,
Matthew
  • skoota
  • OFFLINE
  • Expert Boarder
  • Posts: 89
  • Karma: 2

Re: Delete Button in Detail View Controller 1 year, 7 months ago #4

Tarek,

Can you make that a 1.6.x release?
  • panamind
  • OFFLINE
  • Senior Boarder
  • Posts: 77
  • Karma: 4

Re: Delete Button in Detail View Controller 1 year, 7 months ago #5

Sure, thanks Gary.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72

Re: Delete Button in Detail View Controller 1 year, 6 months ago #6

Hi Tarek,

Just wanted to check if you have had any luck with these modifications to STV? It would be awesome as my project is now at the stage where including this functionality would be really good.

Also, could you advise whether this 1.6.x release will also include the custom 1.6.1 that you provided me (which allowed me to show the detail edit view when a user taps the detail disclosure button, and show a different view controller if they tap the cell itself)? There was also that bug which I advised about regarding the need to set allowEditDetailView = YES, call didSelectCellAtIndexPath:indexPath, and then set allowEditDetailView = NO in the accessoryButtonTappedForRowWithIndexPath delegate method to show the detail edit view. It may be worthwhile fixing that little issue before rolling this new functionality into a general release

Thanks,
Matthew
  • skoota
  • OFFLINE
  • Expert Boarder
  • Posts: 89
  • Karma: 2
Time to create page: 1.05 seconds