Reputation: 1011
I have this code:
...
NSData * dimage = [[NSData alloc]initWithData:[datosImagen objectForKey:@"Image"]];
UIImage * imagenAMostrar = [[UIImage alloc] initWithData:dimage];
UIImageView * imAMostrar = [[UIImageView alloc] initWithImage:imagenAMostrar];
...
I need resize my UIImageView, similar to this dimensions: setFrame:CGRectMake(0,60,320,240)
.
but for this i need UIImageView size....
NSLog(@" Image width:%d",imagenAMostrar.size.width);
NSLog(@" Image height:%d",imagenAMostrar.size.height);
The result is:
2011-10-03 13:32:28.993 Catalogo-V1[2679:207] Image width:0
2011-10-03 13:32:28.994 Catalogo-V1[2679:207] Image height:0
Why??
Upvotes: 1
Views: 827
Reputation: 51374
Didn't you get any warnings in NSLog statements? You should be getting a conversion type warnings. width
and height
are float-s
. You are supposed to use %f
as conversion specifier. You should be printing them like this,
NSLog(@" Image width:%f", imagenAMostrar.size.width);
NSLog(@" Image height:%f", imagenAMostrar.size.height);
You can set the frame of image view like this,
imAMostrar.frame = CGRectMake(0, 60, imagenAMostrar.size.width, imagenAMostrar.size.height);
Upvotes: 1