• C

photo gallery

is there a way to have photos display just like a camera roll but use the photos from a folder instead of the pictures from my library?
BTMExpertAsked:
Who is Participating?
 
pgnatyukCommented:
I don't think that my answer will be enough for you. Because of that I didn't answer before.
I do not think it is a grid view. From my point of view it is an image that contains all images from the folder. Let's say that screen size is 480x320, so you decide to show the images from the folder in the same proportion. For example 48x32. So you take each image from the folder, scale and copy it to the big image into the 0 position - first rectangle in the first line. Then you take the second image, scale it and copy to the second rectangle of the first line. And so on. The result image you show on the screen.
I really do not want to make a code for it.  
0
 
iPinkyCommented:
you can use "quick look": select all images in a folder and hit the spacebar, that's the cheapest and easiest way…

there are third party tools who let you view pictures from folders (insteas of from you iPhoto Library), check out xee (http://wakaba.c3.cx/s/apps/xee.html) or CocoViewX( http://www.stalkingwolf.net/software/cocoviewx/)  
0
 
BTMExpertAuthor Commented:
thank you for the response but i need something for the iphone.  The iphone camera roll shows pictures in a tiled or grid view.  I want to know how you do that but instead of using images from the camera library, use pictures from a folder I'm creating.
0
The Firewall Audit Checklist

Preparing for a firewall audit today is almost impossible.
AlgoSec, together with some of the largest global organizations and auditors, has created a checklist to follow when preparing for your firewall audit. Simplify risk mitigation while staying compliant all of the time!

 
BTMExpertAuthor Commented:
i think i'm trying that with this:

scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      //scrollView.delegate = self;
      scrollView.bouncesZoom = YES;
      scrollView.backgroundColor = [UIColor blackColor];
      
      containerView = [[UIView alloc] initWithFrame:CGRectZero];
      [scrollView addSubview:containerView];
      
      CGFloat maximumWidth = 0.0;
      CGFloat totalHeight = 0.0;
      CGFloat totalWidth = 0.0;
      
      for(int i = 1; i <= 11; i++) {
            UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png", i]];
            if(totalWidth > 320) {
                  totalWidth = 0;
            }
            
            CGRect frame = CGRectMake(totalWidth, totalHeight, image.size.width - 30, image.size.height - 30);
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
            imageView.image = image;
            
            [containerView addSubview:imageView];
            [imageView release];
            
            maximumWidth = MAX(maximumWidth, image.size.width);
            totalHeight += image.size.height;
            totalWidth += image.size.width;
      }
      
      containerView.frame = CGRectMake(0, 0, 320, totalHeight);
      scrollView.contentSize = containerView.frame.size;


but my images don't go side by side or in a grid for that matter.  am i missing something in the frame loop?
0
 
pgnatyukCommented:
I'd say it's a wrong calculation. I can be wrong I do not know what you want.
Pay attention on these lines:

            CGRect frame = CGRectMake(totalWidth, totalHeight, image.size.width - 30, image.size.height - 30);

and

            maximumWidth = MAX(maximumWidth, image.size.width);
            totalHeight += image.size.height;
            totalWidth += image.size.width;

This code is supposed to do what? Can you explain?

0
 
BTMExpertAuthor Commented:
it places the image on the view inside the frame.  the totalwidth and totalheight are the position of the frames and the image sizes are the sizes of the frame.  so i'm trying to put them side by side so i keep adding the width of each image so i can get the position of the next image.  but maybe i'm missing something or maybe there's an easier way.
0
 
pgnatyukCommented:
On Mac OS X you can use Image Kit.
http://www.macresearch.org/cocoa-tutorial-image-kit-and-image-browser-views-part-i
It looks better and works faster. I do not know if exists something like that for iPhone.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.