I need some basic guidance. I have minimal iOS training and don't know the best way to add the following enhancement to a massive iOS app I inherited.
Within the app is a collection view. If I tap on one of the cells, it brings up a detail screen wherein I can edit the data that is summarized from that screen back on the cell. Clicking the "Done" button up in the title bar of that detail view will close that screen and return the user to the collection view. Each cell in the collection view is a record that is stored in the local SQLITE database somehow (sorry, I haven't really figured out that whole mechanism yet).
There is an enhancement requirement for the user to be able to select any one of the cells in the collection view and then initiate some sort of action to duplicate the cell and its data contents, displaying the detail page of the new cell in the process. So, here is the flow:
- User is looking at the collection view and somehow selects a cell to duplicate (tap? long-press? double-tap? check box selection?)
- User is presented with option (menu? button?) to duplicate the cell or cancel.
- Selecting "Cancel" simply returns to the original collection view.
- Selecting "Duplicate" or "Copy" or whatever, opens the detail page for that cell with all data populated the same as if they were just tapping to open/edit the original. However, the "Name" field needs to be blank because that's what the database uses as the primary key for each record.
- User edits the data as required, then enters a new value for the "Name" field.
- User clicks "Done" button to save new record to the database.
This is somewhat like the process for clicking "Select" in the iOS "Photos" app, then selecting photos in the collection by tapping, then clicking the "Share" icon and selecting "Copy". In my case, though, I need to duplicate one entire record, not just one or more singular items like photos.
My question is, what is the simplest way for a total newb to implement this behavior? How, in basic terms, do I essentially allow the user to duplicate a record in the database (which is represented by a collection view cell and its associated detail page), but blank out one of the fields?
I've read that I can enable the "Edit" menu for a collection view cell, but that appears to require a long-press gesture and there is already a long-press gesture enabled that brings up a hidden "Delete" button to delete a cell. I want to do the opposite and use some sort of two-finger tap or long-press or check box selection to DUPLICATE a cell.
I'm at a loss for whether I need to do this from within the database itself (which has gazillions of files/datamodels/database contexts that I don't understand yet) or whether the aforementioned "Edit" menu will take care of that for me if I just enable its appearance somehow, or whether the data source needs to link those two, or what.
Again, I'm very new to iOS development and inherited a project 100 times more complex than any "Hello World" app I did in class. If someone can just outline the basic steps required to do this, I'll absolutely do all the tenacious research to teach myself how to create the code. I can find tons of posts about people needing to DELETE duplicates in the database, but nothing about how to basically CREATE one.
I apologize for the lengthy post, but I want to be as clear as possible. Thank you very much for any guidance you can offer!
P.S. I tried to add helpful screen shots, but apparently I can't without more "reputations".
Aucun commentaire:
Enregistrer un commentaire