最新的iPhone 4有图像显示问题

问题描述 投票:0回答:1

较旧的 3GS 或 iPod 4 能够显示最终的临时图像,但在 iPhone 4 上,我在屏幕上看不到临时视图。

我逐步完成它,获取 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];
}
iphone cocoa-touch ios4
1个回答
1
投票

尝试这样..

-(void) display:(NSData*) imageData
{
if(imageData != nil)
{
   tempimage= [[UIImage alloc] initWithData:imageData];
}
else
{
   tempimage= [UIImage imageNamed:@"something.png"];
}


}
[tempview release];
}
© www.soinside.com 2019 - 2024. All rights reserved.