I am facing a problem while displaying the image in iphone. I used the below code but it work only for .png files.
UIImageView* imageView=[[UIImageView alloc] initWithFrame:CGRectMake(6,10, 80, 80)];
imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:customerListObject.customerImage]]];
[myView addSubview:imageView];
[imageView release];
I could not display the other types of image file, Please suggest me the solution.
Thank you, Madan Mohan
Try using this:
imageView.image = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"imagename" ofType:@"png"]];
And then replace imagename and png with your file name and type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With