开发者

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 ta开发者_StackOverflow社区ble 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......


Find the blog tutorial for creating thumbnail of an image programmatically

http://johnnytrops.com/blog/wp/2009/02/03/iphone-creating-an-image-thumbnail/

Here is one more

http://www.nickkuh.com/iphone/how-to-create-square-thumbnails-using-iphone-sdk-cg-quartz-2d/2010/03/


- (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);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜