gpt4 book ai didi

iphone - 数组与对象 : Objects should be NSStrings

转载 作者:搜寻专家 更新时间:2023-10-30 19:51:53 25 4
gpt4 key购买 nike

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

self.component1Data = [NSArray arrayWithObjects: @"Sample", @"Sample1", @"...", nil];

如何获得 NSString 而不是“样本”?我用 "%@"试过了,但它不起作用:

self.component1Data = [NSArray arrayWithObjects: @"%@",string, @"%@",string2, @"...", nil];

最佳答案

self.component1Data = [NSArray arrayWithObjects: string, string2, nil];

假设 string 和 string2 是 NSString * 类型。

关于iphone - 数组与对象 : Objects should be NSStrings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2038908/

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