UA-17470720-3

Jump to content


Photo
- - - - -

support for ABPeoplePickerNavigationController


  • Please log in to reply
6 replies to this topic

#1 Josh Highland

Josh Highland

    Starting Out

  • STV 2.0
  • Pip
  • 0 posts
Reputation: 0
Neutral

Posted 13 July 2011 - 10:19 PM

Is there, or is their planned support to work with the Address Book, specifically the ABPeoplePickerNavigationController.

I would like to be able to select a contact from the address book and have information returned back to a table. STV is awesome and saves me a ton of time, I'm hoping that it dont have to switch back the old way of working with forms to interact with the Address Book.

thanks,

--Josh

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 14 July 2011 - 10:06 PM

Hi Josh and welcome to our forums! :)

Actually your suggestion of integrating STV with the address book is a really neat idea! We'll definitely add this to our feature requests. Thanks!

As for now, you can easily bind STV to the contact data returned using one of two ways:

a. Object Binding: Here you'll create a custom object representing the address book contact, assign the contact's data to its respective properties, and have STV bind itself to it.

b. Key Binding: Just directly assign the contact data to STV's SCTableViewModel 'modelKeyValues' property. For more on using the key-binding method, please refer to the following video tutorial: http://www.sensiblec...g-tutorial.html

Hope this helps, and thanks again for the idea :)

#3 sean henri

sean henri

    Starting Out

  • STV 3.0 Pro
  • Pip
  • 3 posts
Reputation: 1
Good

Posted 02 May 2012 - 02:52 PM

Howdy:
I'm looking to implement something similar. Has this feature been added? Or is this still the recommended approach?

Thanks in advance!

#4 nick

nick

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 19 posts
Reputation: 2
Good

Posted 25 October 2012 - 03:29 AM

Tarek

I have almost integrated the people picker. I am using Core Data to store the value for the First and Last Name. I only want to store these in Core Data once the user clicks on the Done button from the presenting detail table view. This means that the user will be able to click on Cancel and the current First and Last Names will be retained. I have been able to do this by updating the boundObject within the itemEditedSection... and itemAddedSection delegates:


[self.tableViewModel.activeCell.boundObject setValue:self.combinedName forKey:@"name"];


I have set the cell on the detailed view to be a SCPropertyTypeLabel. My issue is trying to figure out how to update the Cell's displayed value before the user has clicked on the Done button and updated the value in Core Data. From page 64 I know the cell has a text label. However cannot find out how to get to that label when using an entity definition.

Is this possible?

Thanks in advance

Nick

#5 nick

nick

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 19 posts
Reputation: 2
Good

Posted 26 October 2012 - 04:40 PM

Realised I was coming at this from the wrong angle!

Needed to store the current value on loading and then reset it if the user decides to cancel. Needs to be that way as the Cell text is bound automatically by STV.

#6 nick

nick

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 19 posts
Reputation: 2
Good

Posted 27 October 2012 - 05:07 PM

Okay so now I can see two ways of doing this. The first way is to push the value returned by the People Picker into the text field which was how I was first thinking about it.


SCTableViewSection *section = [self.tableViewModel.activeDetailModel sectionAtIndex:0];

if([section isKindOfClass:[SCObjectSection class]])

{

SCObjectSection *objectSection = (SCObjectSection *)section;

SCLabelCell *nameCell = (SCLabelCell *)[objectSection cellForPropertyName:@"name"];

nameCell.label.text = self.combinedName;

}



The other is to save the current value using the following


-(void)tableViewModel:(SCTableViewModel *)tableModel detailViewDidPresentForRowAtIndexPath:(NSIndexPath *)indexPath withDetailTableViewModel:(SCTableViewModel *)detailTableViewModel

{


SCTableViewSection *section = [detailTableViewModel sectionAtIndex:0];

if([section isKindOfClass:[SCObjectSection class]])

{


self.originalName = [section.boundObject valueForKeyPath:@"name"];


}

}


and then push this value back if the user hits the Cancel button.

Tarek - what is the preferred route? The other cells don't seem to push the changes into Core Data until the Done button is click so I am thinking that my first approach is more consistent with the framework. It also seems to have less overhead to it.

Nick

#7 tjozsa

tjozsa

    Starting Out

  • STV Lite
  • Pip
  • 1 posts
Reputation: 0
Neutral

Posted 07 November 2012 - 10:11 AM

Hi Everyone,

I have a bunch of generated detail views and I have the task to add a UIBarButtonItem to one of the generated detail views and when the user clicks it the ABPeoplePickerNavigationController should be presented modally.

I tried to avoid it but I need help. So I would be grateful if someone would write down how you guys actually presenting the ABPeoplePickerNavigationController in a modal view from a generated detail view.

Thanks a lot,
Regards,
Tamas




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users