【发布时间】:2010-10-08 04:05:09
【问题描述】:
我在 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];
显示文本:
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];
【问题讨论】:
-
您可以编辑您的帖子以使代码具有语法突出显示吗?
标签: iphone objective-c ios4