Solved

photo gallery

Posted on 2010-08-20
7
619 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

809 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