milof
milof

Reputation: 696

How do I access a custom object field within a NSMutable Array?

I have a custom object like:

 #import <Foundation/Foundation.h>


    @interface FaxRecipient : NSObject {


        NSString * contactID;
        NSString * name;
        NSString * fax;
        NSString * company;
        NSString * phone;

    }
    @property(nonatomic,retain)NSString *contactID;
    @property(nonatomic,retain)NSString *name;
    @property(nonatomic,retain)NSString *fax;
    @property(nonatomic,retain)NSString *company;
    @property(nonatomic,retain)NSString *phone;

    @end

I have an array of NSMutableArray (remoteRecipientItems )containing FaxRecipient objects.

However I am trying to just set the value of a UITableView cell by using the name:

[[cell textLabel]setText:[remoteRecipientItems objectAtIndex:[indexPath row]]]; //I want to only use the name value of FaxRecipient. Sorry for the newbie question.

Upvotes: 0

Views: 87

Answers (1)

Suny
Suny

Reputation: 1175

FaxRecipient *faxObject= [remoteRecipientItems objectAtIndex:indexPath.row];//This is ur object
cell.textLabel.text=faxObject.name;//this sets the name

Upvotes: 5

Related Questions