开发者

Random facebook profile id generator

Right I have a programme that displays a profile facebook profile picture when a button is touched accessed by using the graph api as shown. in the url: http://graph.facebook.com/517418990/picture?type=large The number can be changed to show a different profile picture (some numbers dont work but that is a different question. How in xcode can i firstly generate a random number (i assume it has to have some kind of structure not just a random 9 digit number) and secondly how can i load a new random number with each push of the button. E.g. push button = display profile of random number, push 2 = display profile of new random number etc etc. Some of the code below is not completely relevant because i also have an array with some images in it that to go through. Thanks in advance!

@interface FacebookPicturesViewController : UIViewController {

IBOutlet UIImageView *imag开发者_Go百科eView;
NSInteger imageCount;
NSArray *imageArray;
NSString *profileLink;

} - (IBAction) nextImagePush; @end

@implementation FacebookPicturesViewController

  • (IBAction) nextImagePush {

    UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://graph.facebook.com/517418990/picture?type=large"]]]; [imageView setImage:img];

    if (imageCount >= [imageArray count]){ imageCount = 0; } }

  • (void) viewDidLoad { imageArray = [[NSArray alloc] initWithObjects:@"image1", @"image2", nil]; imageCount = 0; }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜