images #137

KobeCena opened this Issue Jul 20, 2012 · 0 comments


None yet
1 participant

Im kinda new to GridView, how to load images from NSDocumentDirectory, here is how I save them:

            NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,    NSUserDomainMask ,YES );
            NSString *documentsDir = [paths objectAtIndex:0];
            NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"oneSlotImages%d.png", i]];

                    ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation];
                    UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];

                    //----resize the images
                    image = [self imageByScalingAndCroppingForSize:image toSize:CGSizeMake(256,256*image.size.height/image.size.width)];

                    NSData *imageData = UIImagePNGRepresentation(image);
                    [imageData writeToFile:savedImagePath atomically:YES ];

and can this have an option, to for example if an image is deleted will retain it, and if one image is deleted will return the old one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment