load image

Discussion in 'iOS Programming' started by Binju, Feb 20, 2010.

  1. Binju macrumors member

    Jan 31, 2010
    Its a simple thing but i get confused,
    I need to display 4 images in the 4 imageviews from the server,button1 - image1,button2 -image2

    I used the below code
    myimage=[[stream objectAtIndex:0] objectForKey:@"Imagelink"];
    	NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: myimage]];
    	imageview1.image =[UIImage imageWithData: imageData];
        imageview2.image =[UIImage imageWithData: imageData];

    Both imageviews loaded same image only.ie the last image.Is it possible to use the imageview name as imageview+i?
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    Regardless of what the value of i us you are always reading from the stream (whatever that is: you haven't told us) at index 0. As I don't know what stream is that may or may not be an error but it looks wrong to me.

Share This Page