4
我在iphone中顯示圖像時遇到問題。我使用下面的代碼,但它只適用於.png文件。如何在iPhone中顯示類型.jpeg或.gif或.tiff的圖像sdk
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];
我無法顯示其他類型的圖像文件,請建議我解決方案。
謝謝 馬丹磨憨
使用該
你試過用本地圖像和[UIImage imageNamed:@「」]? – Vinzius 2010-10-13 12:30:54
它與它一起工作,但我需要與其他類型顯示 – 2010-10-13 13:46:05
你確認你對[NSData dataWithContentsOfURL:]和[UIImage imageWithData:]的調用不返回零嗎?也就是說,你是否從URL獲取數據,並且數據是否成功地轉化爲UIImage? – Ryan 2010-12-03 17:31:36