Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 组合文本标签的数组和文字以填充表行_Arrays_String_Ios7_Append_String Literals - Fatal编程技术网

Arrays 组合文本标签的数组和文字以填充表行

Arrays 组合文本标签的数组和文字以填充表行,arrays,string,ios7,append,string-literals,Arrays,String,Ios7,Append,String Literals,我使用数组allscores来解析填充表行中的文本标签scorelbl cell.scorelbl.text = [allscores objectAtIndex:[indexPath row] - 1]; 这将在表行中打印 1 2 3 2 etc 我现在需要在数组的每个对象旁边添加一些文字,以便打印 1/5 2/5 3/5 2/5 etc 我知道如何在一个字符串中实现这一点,但我正在寻找一种简单的方法将其集成到阵列的现有行中。有什么想法吗 for (int i=0; i<[alls

我使用数组allscores来解析填充表行中的文本标签scorelbl

cell.scorelbl.text = [allscores objectAtIndex:[indexPath row] - 1];
这将在表行中打印

1
2
3
2
etc
我现在需要在数组的每个对象旁边添加一些文字,以便打印

1/5
2/5
3/5
2/5
etc
我知道如何在一个字符串中实现这一点,但我正在寻找一种简单的方法将其集成到阵列的现有行中。有什么想法吗

for (int i=0; i<[allscores count]; i++) {
  NSString* string = [allscores objectAtIndex:i];
  NSString * scorestringformatted = [NSString stringWithFormat:@"%@/5", string];

  [allscores replaceObjectAtIndex:i withObject:scorestringformatted];
}
1/5
2/5/5
3/5/5/5
2/5/5/5/5
etc