Yoav Schwartz
Yoav Schwartz

Reputation: 2027

displaying single image correctly

im using AQgridview to display a facebook album, and every time you press one of them theres a segue to a view with a that image, on the whole screen.

the problem is i just cant seem to get it to show correctly, it just looks very bad quality. first i tried stretching it on the whole screen no matter the original size and it looked awful, now i wrote some code to keep the original width to height ration as the original picture and still no ciger, any help?

if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait)
{
    if (width<=320 && height<=480)
    {
        [self.photo setFrame:CGRectMake(0, 0, width,height)];
    }
    else if (320/width <= 480/height)
    {
        double number = (double) height*320/width;
        NSLog(@"work: %f", number);
        [self.photo setFrame:CGRectMake(0, 0, 320,number)];
    }
    else if (480/height < 320/width)
    {
        double number = (double) width*480/height;
        NSLog(@"work: %f", number);
         [self.photo setFrame:CGRectMake(0, 0, 480/height*width,480)];
    }
    [self.photo setImageWithURL:self.photoURL];

do you know whats the issue? alternatively can anyone offer a class someone prepared to correctly show an image? i heard of many photo gallery ready made classes but non of them seem to support arc

Upvotes: 0

Views: 64

Answers (1)

Yoav Schwartz
Yoav Schwartz

Reputation: 2027

i found out i had imported poor quality pictures from facebook and thats the problem with the quality. the alogrithem for resizing works fine.

Upvotes: 1

Related Questions