Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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
Iphone 如何在自定义单元格到详图视图中显示图像_Iphone_Xcode_Storyboard - Fatal编程技术网

Iphone 如何在自定义单元格到详图视图中显示图像

Iphone 如何在自定义单元格到详图视图中显示图像,iphone,xcode,storyboard,Iphone,Xcode,Storyboard,使用上述代码,我将tableview单元格中的文本显示为详细视图 我还想在细节视图中显示对应于每一行的图像。问题在于我知道的评论部分 需要进行哪些修改 取消注释时,我收到错误:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[NSConcreteData getCharacters:range::]:未识别的选择器首先发送到实例 我认为您应该移动[NSString stringWithFormat:[mutablerarray1 objectAt

使用上述代码,我将tableview单元格中的文本显示为详细视图

我还想在细节视图中显示对应于每一行的图像。问题在于我知道的评论部分

需要进行哪些修改

取消注释时,我收到错误:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[NSConcreteData getCharacters:range::]:未识别的选择器首先发送到实例 我认为您应该移动
[NSString stringWithFormat:[mutablerarray1 objectAtIndex:indexPath.row]]在推送命令上方

我不明白你的问题标题和内容之间的关系

顺便说一句,第三名 您正在使用-

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *__strong)indexPath
{


    TestViewController*detail = [self.storyboard instantiateViewControllerWithIdentifier:@"TestView"];


    [self.navigationController pushViewController:detail animated: YES];

    detail.outputLabel.text =[NSString stringWithFormat:[mutablearray1 objectAtIndex:indexPath.row]];
      // detail.outputImage.image =[NSString stringWithFormat:[mutablearray2 objectAtIndex:indexPath.row]];  
}
@end
不恰当

要操作字符串时,将使用
[NSString stringWithFormat:
-

    [NSString stringWithFormat:[mutablearray1 objectAtIndex:indexPath.row]];
当%@将替换为逗号后的单词时。(还有更多,但我想给你一个基本的想法)

如果您只是想传递一个单词,您应该简单地(我假设您的数组包含字符串!):


希望对您有所帮助

我假设
outputImage
是一个UIImageView对象。
我看你是在设置
NSString
对象,而不是
UIImage
对象。请检查。

这通常发生在您过度释放对象时。检查mutableArray2的内容是否完整精细的解释。我移动detail.outputLabel.text=[[mutablearray1 objectAtIndex:indexPath.row];在push命令上方。但随后细节视图显示为空。解决它。代码:[self.navigationController pushViewController:detail动画:是];detail.outputLabel.text=[mutableray1 objectAtIndex:indexath.row];detail.outputImage.image=[[UIImage alloc]initWithData:[mutableray2 objectAtIndex:indexath.row]];
  NSString * str1 = @"hellow";
  str1 = [NSString string with format:@"str1 %@",world];
   detail.outputLabel.text =[[mutablearray1 objectAtIndex:indexPath.row];