swift_dan
swift_dan

Reputation: 2648

TableViewCell - Gather ManagedObject

my question is regarding a specific "problem" where I am struggling since hours.

I am having a custom cell (ViewController is ToDoCellVC) in TableViewController "ToDoVC" filled with 2 elements "Title" and "Date".

When I select the cell and delete it -> its working.

But I am also having two buttons inside each cell who should perform 2 actions:

I think I could accomplish the code by myself if I found a method to gather information about current cell using NSManagedObjectContext.

Upvotes: 1

Views: 45

Answers (1)

Adrian
Adrian

Reputation: 16735

Rather than having 2 separate entities for your ToDoList, I would have one entity with an isDone Boolean attribute.

  • Cells on your ToDoTVC would display objects where isDone is false

and

  • Cells on your DoneTVC would display objects where isDone is true.

When you create your ToDoListItem, set its initial value to false.

Here's a post on using NSPredicates you'll find helpful for populating your TableViewControllers.

NSPredicate - filtering values based on a BOOLEAN stored value

Upvotes: 1

Related Questions