我有一個非常簡單的代碼很大的問題。 我需要從Facebook URL獲取圖片並將其放在UIImageView上。從網絡獲取圖像到UIImageView不起作用
我不知道但不工作。 我也試過不同的鏈接(沒有Facebook的鏈接也不工作)。
-(IBAction)setUserPhoto:(id)sender{
NSURL *url = [url initWithString:@"http://graph.facebook.com/100000769380612/picture?type=large"];
NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:imageData];
if(image){
NSLog(@"Image OK");
} else if (!image) {
NSLog(@"Error");
}
[userPhoto setImage:image];
}
謝謝。
不,我改變了它。還有其他問題。 – Byteros 2012-03-22 12:43:52
我剛剛編輯我的答案,請嘗試它,它對我的工作很好 – Raj 2012-03-22 12:48:40
Woooow。是工作。謝謝Rajesh。 – Byteros 2012-03-23 11:07:38