UA-17470720-3

Jump to content


Photo
- - - - -

Edit mode when there are no items in the array

sections

  • Please log in to reply
2 replies to this topic

#1 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 541 posts
  • LocationIreland
Reputation: 134
Popular

Posted 10 October 2012 - 08:35 AM

My last topic today :-)

I have the following code:

SCArrayOfObjectsSection *itemsSection = [SCArrayOfObjectsSection sectionWithHeaderTitle:nil entityDefinition:itemsDefinition];
itemsSection.placeholderCell = [SCTableViewCell cellWithText:@"Edit to add an Item..." textAlignment:NSTextAlignmentCenter];

itemsSection.addNewItemCell = [SCTableViewCell cellWithText:@"Add an Item..."];
itemsSection.addNewItemCellExistsInNormalMode = NO;
itemsSection.addNewItemCellExistsInEditingMode = YES;

Which all works. But the user has to tap Edit to get the "Add an Item..." cell. So how can I put the table into edit mode when there are no items? There don't seem to be any actions or delegates that I can hook into as far as I can see.
Cheers,

Dave

www.dgapps.ie

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 12 October 2012 - 04:47 AM

I think all you need is change:

itemsSection.addNewItemCellExistsInNormalMode = NO;

To:

itemsSection.addNewItemCellExistsInNormalMode = YES;

Does this work for you?

#3 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 541 posts
  • LocationIreland
Reputation: 134
Popular

Posted 12 October 2012 - 08:49 AM

Hi Tarek,

I was doing that originally, and it sort of works.

Adding items won't be a very frequent action, so I wanted to hide the add button. And I don't get the green plus symbol until the table is in edit mode either.

Of course my beta testers might think the add button should always be visible anyway!
Cheers,

Dave

www.dgapps.ie





Also tagged with one or more of these keywords: sections

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users