lilzz
lilzz

Reputation: 5413

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];
    tempview=[[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease];

    if (tempimage) {
        [tempview setImage:tempimage];

        [self.view addSubview:tempview];
}

Upvotes: 0

Views: 129

Answers (1)

user141302
user141302

Reputation:

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];
}

Upvotes: 1

Related Questions