• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
KVC Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVC Question


  • Subject: KVC Question
  • From: Joseph Crawford <email@hidden>
  • Date: Thu, 9 Oct 2008 22:04:33 -0400

Hello,

To give a bit of a background what I am doing is writing an application that will query the whitepages.com web api. I have all the XML parsing done so that it parses all the results into a results array that I am trying to use for my table data source. I am trying to set this up to use KVC but I am having a little problem. I have read the docs on apple about KVC but I cannot seem to get it to return more than 1 row to my tableview.

Here is how I have things setup. I am using view swapping and I am trying to keep things abstracted to avoid code duplication.

I have my classes setup like this

CBSManagingViewController
CBSSearchNameViewController (extends CBSManagingViewController)

I have an NSMutableArray named results which is allocated and initialized in the CBSManagingViewController. Each result object is an instance of CBSSearchNameResult which holds 2 more arrays for the people and phone numbers and 1 address object.

The issue I am running into is that when I run a search only the first row in the table view is populated with data from my results array. I am thinking this is because the valueForKey method is not passed the row index so it does not know which result object to return.

I have the model key path for my first name column set to primaryPerson.firstName, this is calling the primaryPerson method which returns an instance of the person object. Then it will use the value of the firstName property to populate the table column.

Here are the sources for my files.

CBSManagingViewController 			- 		http://pastebin.com/m2a17cfb9
CBSSearchNameViewController 			- 		http://pastebin.com/m15821f48
CBSSearchNameResult				-		http://pastebin.com/m3b7bc0b9
CBSPerson						-		http://pastebin.com/m61d8c4a7
CBSPhone							-		http://pastebin.com/m5a2cf323
CBSAddress						-		http://pastebin.com/m4e283ca8

This is my first application so please be gentle with any feedback on the code.

Thanks,
Joseph Crawford
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: KVC Question
      • From: Nathan Kinsinger <email@hidden>
  • Prev by Date: Re: Strategy for naming support folder
  • Next by Date: Re: [NSApp stop:]
  • Previous by thread: Re: How do I debug this? [SOLVED]
  • Next by thread: Re: KVC Question
  • Index(es):
    • Date
    • Thread