2011-09-07 172 views
0

我有一個非常簡單的UIImageView,我可以從facebook上顯示個人資料圖片(代碼如下所示)。要獲取圖片的網址,我只需轉到任何人的個人資料(如果您已經登錄,獲得他們作爲朋友等無關緊要),右鍵單擊他們的個人資料圖片並選擇「複製圖像地址」並將其粘貼到代碼中。我知道你也可以通過改變這個http://graph.facebook.com/harryhall1/picture?type=large的圖片url來獲取圖片,要麼工作正常。使用UIImageView來顯示隨機的Facebook個人資料圖片

現在,我的問題是我可以得到這個從隨機配置文件生成個人資料圖片?在我看來,這應該是可能的,因爲我不必登錄Facebook等來查看任何隨機的個人資料圖片,我可以右鍵點擊他們的個人資料圖片並保存,複製網址等。我只是不知道如何獲得隨機配置文件ID。我真的很感謝這個傢伙的幫助。

@interface NextImageViewController : UIViewController { 

    IBOutlet UIImageView *imageView; 
    NSInteger imageCount; 
    NSArray *imageArray; 
} 

- (IBAction) nextImagePush; 

@end 

@implementation NextImageViewController 

- (IBAction) nextImagePush { 

    UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://profile.ak.fbcdn.net/hprofile-ak-snc4/211479_517418990_3896134_n.jpg"]]]; 
    [imageView setImage:img]; 
    imageCount++; 
} 

回答

相關問題