pamo / ToDoList

A To Do List iOS App
0 stars 0 forks source link

Assignment Submission #1

Open pamo opened 11 years ago

pamo commented 11 years ago

Hey @timothy1ee, this isn't quite done yet, but I was wondering if you could guide me in what I have so far?

I've got a navigation controller set up to the tableview we created in class. Added buttons to the navigation bar like the mock-ups and now I want to edit my custom cell to have an textfield. I've tried hooking up a touch event for when the textfield is tapped but there seems to be something missing in my view controller where the event isn't recognized.

I've also tried pre-populating each of the textfields with text but that doesn't seem to be working either.

Am I making editable textviewcells harder than they're supposed to be?

timothy1ee commented 11 years ago

You're very close. Instead of:

[self.tableView registerClass:[ItemCell class] forCellReuseIdentifier:@"ItemCell"];

Do this:

UINib *nib = [UINib nibWithNibName:@"ItemCell" bundle:nil];
[self.tableView registerNib:nib forCellReuseIdentifier:@"ItemCell"];

Alternatively, you can use the Prototype Cells concept which is very similar but doesn't require the cell registration. I was a little surprised that the registerClass method didn't use the nib file somehow. I googled a bit to try to confirm if that was expected, but couldn't get a definitive answer. I tested registerNib and that worked for me though.

timothy1ee commented 11 years ago

Pam, this submission isn't complete. If you can finish by tomorrow, I'll accept the submission. Otherwise, I'll have to ask you to move to the observers section. You'll still have access to the materials and recorded sessions, and you can follow at your own pace.

pamo commented 11 years ago

@timothy1ee could you help me with the major blocker I'm having? When I add a new cell I can enter the text into the textfield. I haven't done anything to dismiss the keyboard but if I go and add a new textfield the table is reloaded with the pre-populated cells and the new cell is lost. Any suggestions on where to keep track of all the cells?

timothy1ee commented 11 years ago

You've probably already guessed why the text is being cleared. You're loading the cells from self.items, which is correct. However, you never write back into self.items, so that array is always filled with blank strings.

You need to leverage the UITextField delegate methods to track the state of the UITextField. You can use those event methods to update the self.items array.

pamo commented 11 years ago

@timothy1ee can you take a look again? Items seem to be persisting properly now with one minor issue when I add another... http://cl.ly/S1gO

timothy1ee commented 11 years ago

Did you push your changes? I don't see anything new.

pamo commented 11 years ago

Pushed again, I was in a detached branch locally for some reason.

timothy1ee commented 11 years ago

In - (void)textFieldDidEndEditing:(UITextField *)textField, you're always assuming that the user is editing the last item. They could also be modifying another item, in which case you will update the wrong index. See this discussion for how to address that issue: https://canvas.instructure.com/courses/818130/discussion_topics/1566443

You should also try implementing saving/restoring todo items. Use either NSUserDefaults or file I/O, NSArray has a built-in helper to load/save itself to disk. NSUserDefaults is a very commonly used tool, you should practice using it.

The next level is to be able to implement the multi-line to do item. It's an illustration of what it takes to really fine tune a UI. It's an intermediate level task. Not incredibly difficult, but may take you as long as the rest of the assignment.

Here's my checklist of things I'm looking at when I'm reviewing this project.