user564963
user564963

Reputation: 2294

creating thumbnail of an image programmatically

in my application i am getting images from the server and i am able to display the images in image view.... but now i want to store the images getting from the server in a table view and display them while clicking in the table view cell . what i want is how to make the thumbnail of the image in order to display it in table view cell .if i display the image directly in table view cell it is some what appearing clumsy.... for that i want to make the thumbnail of that image and to display it in table view cell...

can any one please help me how to create thumbnail of a image programatically......

Upvotes: 3

Views: 2846

Answers (2)

Chetan Bhalara
Chetan Bhalara

Reputation: 10344

- (void) createThumbView { float y_axis = Set y axis;

int x = 0;

int totalImgs = total images;

int tempCnt = 0;

for (int i = 0; i < totalImgs;)
{
    float x_axis = set x axis;

    int loopCount = 0;

    if (totalImgs - tempCnt >= (no of images in row))
    {
        loopCount = (no of images in row);
    }
    else
    {
        loopCount = totalImgs % (no of images in row);
    }

    for (int j = 0; j < loopCount; j++)
    {
        MasksData *mData = [masksList objectAtIndex:x];

        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(x_axis, y_axis, width, height);
        [btn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@.png",mData.bgImage]] forState:UIControlStateNormal];
        btn.backgroundColor = [UIColor  clearColor];
        btn.tag = x;
        [scroll View addSubview:btn];

        //photoCount++;
        x_axis += width + some space;

        tempCnt++;
        i++;
        x++;
    }

    y_axis += height + some space;

    scroll View.contentSize = CGSizeMake(320.0, y_axis);
}

Upvotes: 0

Related Questions