开发者

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

开发者 https://www.devze.com 2023-03-09 03:47 出处:网络
I have a custom object like: #import <Foundation/Foundation.h> @interface FaxRecipient : NSObject {

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.


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

精彩评论

暂无评论...
验证码 换一张
取 消