The latest iPhone 4 has image display issue
The older 3GS, or iPod 4 are able to show the final tempimage, but on the iPhone 4, I don't see the tempview showing up on screen.
I stepped through it, getting imageData, tempimage allocated, tempview allocated, but the final tempview is not showing up.
-(void) display:(NSData*) imageData
{
tempimage= [[[UIImage alloc] initWithData:imageData] autorelease];
开发者_StackOverflow社区 tempview=[[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease];
if (tempimage) {
[tempview setImage:tempimage];
[self.view addSubview:tempview];
}
try like this..
-(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];
}
精彩评论