gpt4 book ai didi

iphone - 如何访问 NSMutableArray 中的自定义对象字段?

转载 作者:行者123 更新时间:2023-11-28 18:44:37 25 4
gpt4 key购买 nike

我有一个自定义对象,例如:

 #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

我有一个包含 FaxRecipient 对象的 NSMutableArray (remoteRecipientItems) 数组。

但是我试图通过使用名称来设置 UITableView 单元格的值:

[[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

关于iphone - 如何访问 NSMutableArray 中的自定义对象字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6183142/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com