iphone – arrayWithObjects:对象应该是NSStrings
发布时间:2020-12-14 17:17:25 所属栏目:百科 来源:网络整理
导读:我使用此代码来归档UIPickerView中的行: self.component1Data = [NSArray arrayWithObjects: @"Sample",@"Sample1",@"...",nil]; 我怎样才能获得NSString而不是“样本”?我尝试使用“%@”但它不起作用: self.component1Data = [NSArray arrayWithObjects
我使用此代码来归档UIPickerView中的行:
self.component1Data = [NSArray arrayWithObjects: @"Sample",@"Sample1",@"...",nil]; 我怎样才能获得NSString而不是“样本”?我尝试使用“%@”但它不起作用: self.component1Data = [NSArray arrayWithObjects: @"%@",string,@"%@",string2,nil]; 解决方法self.component1Data = [NSArray arrayWithObjects: string,nil]; 假设string和string2的类型为NSString *. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |