我在iPhone应用程序中工作,我使用UIImage选择器控件从照片库中选择一个图像,然后处理它并分别使用UIImageview和UITextview显示图像和相应的输出.对于一些图像,它工作正常,并为一些图像程序崩溃,并在检查这个断点时,我收到消息,如PROGRAM RECEIVED SIGNAL SIGABRT.任何人都可以建议我如何处理这个错误.注意:对于我得到输出的每个图像,我用断点检查它.我的示例代码在这里,
要显示图像:
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 240.0f);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:img];
myImage.opaque = YES; // explicitly opaque for performance
[self.view addSubview:myImage];
[myImage release];
Run Code Online (Sandbox Code Playgroud)
要显示文字:
CGRect frame = CGRectMake(0.0f, 250.0f, 320.0f,25.0f);
UITextView * tmpTextView = [[UITextView alloc]initWithFrame:frame];
tmpTextView.text = [NSString stringWithFormat:@"%@%@",@"value: ", somevalue];
[self.view addSubview:tmpTextView];
[tmpTextView release];
Run Code Online (Sandbox Code Playgroud)