UA-17470720-3

Jump to content


Photo
- - - - -

Object Selection with CoreData

core-data

  • Please log in to reply
9 replies to this topic

#1 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 01 February 2015 - 12:44 AM

Greetings Programs!

 

In my coredata app that I've created completely in IB, I have 6 entity definitions in one SCArrayOfObjectSection tableview.

 

Three of the entities are Observation, Site and Contact; O -> S  one to one and S -> O one to many, O -> C one to one and C -> O one to many.

 

Both the Site and Contact relationships in Observation are set up as Object Selection in IB.

 

What I need to be able to do is tap the cell, see to the list of sites or contacts and be able to add a record (with the add cell already there like the way it is with other views) without tapping edit first and then the add button.

 

Can I do this through IB?

 

If I have to use the detail actions to add a button, how do I know which detail view I'm dealing with since I have the 6 entity definitions in a single SCArrayOfObjectSection tableview?

 

Thanks!

 

Wg

 

 


P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 05 February 2015 - 08:24 AM

Hi Wg,

 

Getting into edit mode is essential to the way SCObjectSelectionSection works. Without entering edit mode, tapping a cell would select it (as expected). When in edit mode, tapping a cell will give the user the chance to edit its value and add entirely new items. Is there a certain reason why you don't like entering edit mode?



#3 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 05 February 2015 - 09:02 AM

Hi Tarek!

 

I want the user to have to make the least amount of actions to fill the form.

 

In the first screenshot, they can select the Site.

 

In the second screenshot, I want them to be able to add a new site right away if they don't see the site they want to select without havning to go into edit mode first. If they want to edit the site they could then go into edit mode and do their thing. An Add New button would be nice here.

 

Wg

 

https://www.dropbox....G_8586.PNG?dl=0

https://www.dropbox....G_8587.PNG?dl=0


P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#4 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 05 February 2015 - 09:04 AM

Also, is it possible to have a placeholder for any field? I'd like to be able to show "Required" no matter what type of field it is.

 

Wg


P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#5 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 05 February 2015 - 09:26 AM

Thanks Wg, we'll study your suggestion for our next release.



#6 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 05 February 2015 - 09:27 AM

Regarding placeholders, of course. Simply select the property definition and enter whatever you want in the 'Placeholder' field. Please open a separate topic if you're still having problems with that.



#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 17 February 2015 - 01:51 PM

We have now added 'addNewItemCellExistsInNormalMode' and 'addNewItemCellExistsInEditingMode' properties to SCSelectionCell in our upcoming 4.1.2. To achieve what you want in our Core Data bundled sample (for instance), change the taskSteps type from IB to 'Object Selection', then add the following code to viewDidLoad in MasterViewController.m:

 

- (void)viewDidLoad {
    [super viewDidLoad];
    
    SCDataDefinition *taskDef = [self dataDefinitionWithIBName:@"TaskEntity"];
    SCPropertyDefinition *stepsPDef = [taskDef propertyDefinitionWithName:@"taskSteps"];
    stepsPDef.cellActions.willConfigure = ^(SCTableViewCell *cell, NSIndexPath *indexPath)
    {
        if([cell isKindOfClass:[SCObjectSelectionCell class]])
        {
            SCObjectSelectionCell *objectSelectionCell = (SCObjectSelectionCell *)cell;
            objectSelectionCell.addNewItemCellExistsInNormalMode = YES;
        }
    };
}

  • wizgod likes this

#8 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 17 February 2015 - 02:11 PM

Thanks Tarek! Looking forward to it!

 

Wg


P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#9 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 21 February 2015 - 01:13 AM

Just tried it with 4.1.2...

 

It works but only for the first time you go into the selection view.

 

I tap site to select a site.

I see the Add New cell and tap it.

I add a new site record and select it. At this point there is only one record.

I return to the previous view.

I tap site again to select (add) a new site but the Add New cell is not there.

If I select the last cell (when I add more sites initially) or the only cell in the list, it takes me to the create view instead of selecting it but only on the last/only cell.

 

Wg


Edited by wizgod, 21 February 2015 - 02:08 AM.

P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#10 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 23 February 2015 - 09:00 AM

Yes, you're right. Very strange as it all worked well during testing. We'll fix ASAP (please let me know if you have a deadline).







Also tagged with one or more of these keywords: core-data

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users