gpt4 book ai didi

iphone - 这个 Nsarray 定义有什么问题

转载 作者:行者123 更新时间:2023-11-28 23:16:26 24 4
gpt4 key购买 nike

我想初始化一个 nsstrings 数组我使用下面的代码

@interface Modalities : UITableViewController {

NSArray * Modalities ;

NSArray* SelectedOnes ;
}

@property (nonatomic, retain) NSArray * Modalities ;

@end

- (void)viewDidLoad {
[super viewDidLoad];

// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;

Modalities = [NSArray arrayWithObjects:
@"XA",
@"CT",
@"RF",
@"PR",
@"US",
@"OT",
@"SR",
@"MG",
@"MR",
@"NM",
@"CR" , nil];
}

它提高了

error: expected unqualified-id before '=' token

解决这个问题的任何建议

最佳答案

您为您的字段使用了类的名称,这将导致冲突。

将字段名称更改为

NSArray * modalities;

然后:

modalities = [NSArray arrayWithObjects:
@"XA",
@"CT",
@"RF",
@"PR",
@"US",
@"OT",
@"SR",
@"MG",
@"MR",
@"NM",
@"CR" , nil];

关于iphone - 这个 Nsarray 定义有什么问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6184277/

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