Amazon.com Widgets NSArray has a method to retrieve the name of instance variables oh his objects?
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 21, 2013, 08:53:14 AM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Programming in Objective-C, 4th edition
| |-+  Chapter 15
| | |-+  NSArray has a method to retrieve the name of instance variables oh his objects?
Pages: [1]   Go Down
Print
Author Topic: NSArray has a method to retrieve the name of instance variables oh his objects?  (Read 339 times)
eagle74
Newbie
*
Posts: 24


www.cucinareblog.it


WWW Email




« on: July 02, 2012, 07:17:17 AM »

Maybe the question is a little ambiguous...sorry
I'll try to explain better.

In exercise 5, we have a AddressBook class that contains a NSMutableArray (book).
Inside book there are some objects: AddressCards.
Each AddressCard object has got some instances variables that could be name, address, eMail ...

My question is: does NSArray(or NSMutableArray) have a method to obtain the name of the instance variables of AddressCards?
In my mind it must exist! because AddressBook has got a reference to each object, so it must retrieve its instance variable....

thanks a lot!! Smiley
Logged

"The more i know people the more i love dogs."Socrate
ctlockey
Newbie
*
Posts: 8






« Reply #1 on: July 16, 2012, 11:19:23 AM »

From what I've been able to find on this, you have to write your own using the Obj-C runtime libraries to generate an array of object properties. Then you can loop through that array to do whatever you want.

See: http://stackoverflow.com/questions/1920590/getting-an-array-of-properties-for-an-object-in-objective-c

I'd be interested in the solution Stephen was thinking of when he wrote that question in Exercise 5, too.
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.