Solved

photo gallery

Posted on 2010-08-20
7
617 Views
Last Modified: 2013-11-25
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?
0
Comment
Question by:BTMExpert
  • 3
  • 3
7 Comments
 
LVL 5

Expert Comment

by:iPinky
ID: 33492308
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
 

Author Comment

by:BTMExpert
ID: 33495670
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
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 250 total points
ID: 33495787
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:BTMExpert
ID: 33500291
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
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33500593
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
 

Author Comment

by:BTMExpert
ID: 33500689
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
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33515394
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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
memory leak detection 9 81
TCP/IP Socket - connection close results in data lost 14 133
Resolve Dependency Issues 4 65
Memory going from 12gb to 64gb or 96gb. worth it? 15 173
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question