arrayWithObjects:对象应该是NSStrings

Flo*_*ked 3 iphone xcode objective-c

我使用此代码来归档UIPickerView中的行:

self.component1Data = [NSArray arrayWithObjects: @"Sample", @"Sample1", @"...", nil];
Run Code Online (Sandbox Code Playgroud)

我怎样才能获得NSString而不是"样本"?我尝试使用"%@"但它不起作用:

self.component1Data = [NSArray arrayWithObjects: @"%@",string, @"%@",string2, @"...", nil];
Run Code Online (Sandbox Code Playgroud)

bbu*_*bum 14

self.component1Data = [NSArray arrayWithObjects: string, string2, nil];
Run Code Online (Sandbox Code Playgroud)

假设string和string2属于类型NSString *.