较旧的3GS或iPod 4能够显示最终的温度图像,但在iPhone 4上,我看不到屏幕上显示的是tempview。
我介入了它,获得了imageData,分配了tempimage,分配了tempview,但是最终的tempview没有显示出来。
-(void) display:(NSData*) imageData
{
tempimage= [[[UIImage alloc] initWithData:imageData] autorelease];
tempview=[[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease];
if (tempimage) {
[tempview setImage:tempimage];
[self.view addSubview:tempview];
}
答案 0 :(得分:1)
试试这个..
-(void) display:(NSData*) imageData
{
if(imageData != nil)
{
tempimage= [[UIImage alloc] initWithData:imageData];
}
else
{
tempimage= [UIImage imageNamed:@"something.png"];
}
tempview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
if (tempimage) {
[tempview setImage:tempimage];
[self.view addSubview:tempview];
}
if(imageData != nil)
{
[tempimage release];
}
[tempview release];
}