views:

32

answers:

1

hi all in my application images are loaded from rss feed in table cell. they are of variant size how can i fix them to certain size. my code is

    int blogEntryIndex1 = [indexPath indexAtPosition: [indexPath length] -1];

imgstring=[[blogEntries objectAtIndex: blogEntryIndex1] objectForKey: @"image"];
NSURL *url = [NSURL URLWithString:imgstring];


NSData *data = [NSData dataWithContentsOfURL:url];

UIImage *img = [[UIImage alloc] initWithData:data];
cell.imageView.image=img;

you can view my application screen shot click here

Thanks i will be waiting for your response....

A: 

I think I understand what your'e asking...

What you want to do is to resize UIImages.

UIImage* resizeImageToSize(UIImage* image, CGSize size)
{
    UIGraphicsBeginImageContext(size);

    CGContextRef ctx = UIGraphicsGetCurrentContext();

    //Account for flipped coordspace
    CGContextTranslateCTM(ctx, 0.0, size.height);
    CGContextScaleCTM(ctx, 1.0, -1.0);

    CGContextDrawImage(ctx,CGRectMake(0.0f, 0.0f, size.width, size.height), image.CGImage);

    UIImage* scaled = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();
    return scaled;
}
Joshua Weinberg
What I gave you is a c-style function. It sounds like you're pasting it into the body of another function.
Joshua Weinberg
Why do you keep calling me dear...and how about a checkmark
Joshua Weinberg