Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-11-2010, 08:30 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 13
Default how to create thumbnails

Hey im pretty new to xcode and need help. I am trying to make an app that will view lots of cars. What i am trying to do is make a table like in the "photo" applicatiion that comes with the iphone. i would like to be able to make it in a grid view like photo ad be clickable to display the image in full screen. I know how to add photos into the resources but just need help creating the table. could someone tell me how to do it in interface builder or just by code. All i am looking for is a way to replicate the photo application of the iphone but with my own photos.All help is appreciated. cheers!!!
AlexPacteau is offline   Reply With Quote
Old 02-11-2010, 09:49 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 273
Default

Quote:
Originally Posted by AlexPacteau View Post
Hey im pretty new to xcode and need help. I am trying to make an app that will view lots of cars. What i am trying to do is make a table like in the "photo" applicatiion that comes with the iphone. i would like to be able to make it in a grid view like photo ad be clickable to display the image in full screen. I know how to add photos into the resources but just need help creating the table. could someone tell me how to do it in interface builder or just by code. All i am looking for is a way to replicate the photo application of the iphone but with my own photos.All help is appreciated. cheers!!!
i don't know exactly how the photo viewer works, but i'm assuming that in IB you put a UIScrollView as the whole view, or however much of the view you want to cover. then as you have your thumbnails, say 64X64, you add UIImageViews that you create in your code, one after another, 4 to a row, (or however many fit, you probably want to make it nice and balanced like the photo viewer), and display the thumbnail there.

it's just firguring out the coordinates for each UIImageView.
mickm is offline   Reply With Quote
Old 02-12-2010, 02:56 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 58
Default

i vaguely remember that a apple developer once said they made the photo app using a UITableView, please correct me if i am wrong.
nemsiz is offline   Reply With Quote
Old 02-12-2010, 08:12 AM   #4 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 13
Default

Quote:
Originally Posted by mickm View Post
i don't know exactly how the photo viewer works, but i'm assuming that in IB you put a UIScrollView as the whole view, or however much of the view you want to cover. then as you have your thumbnails, say 64X64, you add UIImageViews that you create in your code, one after another, 4 to a row, (or however many fit, you probably want to make it nice and balanced like the photo viewer), and display the thumbnail there.

it's just firguring out the coordinates for each UIImageView.
Thanks i have done this but how do i get these small thumbnail images to display in large/fullscreen like in the photos app? thanks for your help.
AlexPacteau is offline   Reply With Quote
Old 02-12-2010, 11:21 AM   #5 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 273
Default

Quote:
Originally Posted by nemsiz View Post
i vaguely remember that a apple developer once said they made the photo app using a UITableView, please correct me if i am wrong.
makes sense: no lines between cells, custom cell with 4 UIImageView's per cell...
mickm is offline   Reply With Quote
Old 02-12-2010, 11:23 AM   #6 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 273
Default

Quote:
Originally Posted by AlexPacteau View Post
Thanks i have done this but how do i get these small thumbnail images to display in large/fullscreen like in the photos app? thanks for your help.
you need both. if you don't have access to a full size and a thumbnail, i'll post an algorithm that i use that i got off of another thread here to resize an image. i assume that it will work best going from larger to smaller, as smaller to larger you will lose a lot of detail.
mickm is offline   Reply With Quote
Old 02-12-2010, 02:17 PM   #7 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 13
Default

1

Last edited by AlexPacteau; 02-12-2010 at 02:24 PM.
AlexPacteau is offline   Reply With Quote
Old 02-12-2010, 02:24 PM   #8 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 13
Default

Quote:
Originally Posted by mickm View Post
you need both. if you don't have access to a full size and a thumbnail, i'll post an algorithm that i use that i got off of another thread here to resize an image. i assume that it will work best going from larger to smaller, as smaller to larger you will lose a lot of detail.

Nah i do have both but i dont know how link them together so when i press the small one it opens the page with the big one and im not good with the coding so have no idea on what to do so when i press the small one it will open up a page of the big one.
AlexPacteau is offline   Reply With Quote
Old 02-12-2010, 02:56 PM   #9 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

Quote:
Originally Posted by AlexPacteau View Post
Nah i do have both but i dont know how link them together so when i press the small one it opens the page with the big one and im not good with the coding so have no idea on what to do so when i press the small one it will open up a page of the big one.
you are gonna be better off using a scrollview, it should work like so

1. generate views in the scrollview using nested for loops
2. each view generated, is positioned in the scrollview, and you pass the name of the thumbnail and fullsize image
3. each view has a symbolic link to the main controller
the scrollviewcontroller is pushed into a navigation stack
4. in each view, you have passed the name of the thumbnail, and fullsize image, over the top of the thumbnail which is a uiimageview and uiimage is your thumb
5. upon clicking, the fullsize image is passed through the parent symbolic link to the main controller, new controller is created, fed the fullsize image, and pushed into the stack.
6. clicking back on the navigation controller pops the current controller, and you go back to the main scrollview with all your thumbnails

dont know if this makes sense, or if you have used scrollview or navigationcontrollers, but that is the way i would do it

scrollview means less hasstle in uitableview and trying to customize it
mr tickle is offline   Reply With Quote
Old 02-12-2010, 03:00 PM   #10 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 273
Default

Quote:
Originally Posted by mr tickle View Post
you are gonna be better off using a scrollview, it should work like so

3. each view has a symbolic link to the main controllerit
can you explain this part, i'm not clear how each view has a symbolic link to the main controller...
mickm is offline   Reply With Quote
Old 02-12-2010, 03:16 PM   #11 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

Quote:
Originally Posted by mickm View Post
can you explain this part, i'm not clear how each view has a symbolic link to the main controller...
ok, go here, and download the zip

its a solution i did for a post on another thread

http://www.de-clunk.com/buttonsGalore.zip

in there, the 2 classes you want to focus on are maincontroller.h and .m and button.h and .m

in button.h, i make the class maincontroller available to button.h
@class maincontroller

and then i declare a property

maincontroller *parentLink;
and
@property(assign,nonatomic)maincontroller *parentLink;

this creates the pointer, but it only knows that its of the class maincontroller

now, in the maincontroller.m file, i say obj.parentLink = self;

so when i generate the UIView object, im telling it that i want to create a symbolic (thats what i call it anyway) link back to mainController

this means, from any uiview that is generated in maincontroller object, i can reach back and run its methods, there fore creating the link.

when you build and go in the buttonsGalore project, click one of the buttons, it traces in NSLog (look at the console) showing that a method from the mainController was run, and was called in a subview.
mr tickle is offline   Reply With Quote
Old 02-12-2010, 03:38 PM   #12 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

this is a diagramatically layout of how the app would be structured

http://www.de-clunk.com/imageviewer.jpg
mr tickle is offline   Reply With Quote
Old 02-12-2010, 03:38 PM   #13 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 273
Default

Quote:
Originally Posted by mr tickle View Post
ok, go here, and download the zip

its a solution i did for a post on another thread

http://www.de-clunk.com/buttonsGalore.zip

in there, the 2 classes you want to focus on are maincontroller.h and .m and button.h and .m

in button.h, i make the class maincontroller available to button.h
@class maincontroller

and then i declare a property

maincontroller *parentLink;
and
@property(assign,nonatomic)maincontroller *parentLink;

this creates the pointer, but it only knows that its of the class maincontroller

now, in the maincontroller.m file, i say obj.parentLink = self;

so when i generate the UIView object, im telling it that i want to create a symbolic (thats what i call it anyway) link back to mainController

this means, from any uiview that is generated in maincontroller object, i can reach back and run its methods, there fore creating the link.

when you build and go in the buttonsGalore project, click one of the buttons, it traces in NSLog (look at the console) showing that a method from the mainController was run, and was called in a subview.
downloaded it, i'll check it out.

thanks!
mickm is offline   Reply With Quote
Old 02-12-2010, 03:45 PM   #14 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

Quote:
Originally Posted by mr tickle View Post
this is a diagramatically layout of how the app would be structured

http://www.de-clunk.com/imageviewer.jpg
to go into how you position the UIViews inside the scrollview, thats the nifty part

you have 2 for loops

for(int rows=0; rows<=10; rows++){
for(int cols=0; cols<=1; cols++)
{
// here you calculate the x and y coordinates of the UIViews position using the values rows and cols with some simple addition and multiplication based on the size of the thumbnails
}
}

it means that each time rows runs 1 time
cols will run twice, so you can change that and have 3 images per row

where cols would be cols<=2 inside the for loop (that means it will go in sequence 0,1,2)
mr tickle is offline   Reply With Quote
Old 02-12-2010, 07:12 PM   #15 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 13
Default

Quote:
Originally Posted by mr tickle View Post
you are gonna be better off using a scrollview, it should work like so

1. generate views in the scrollview using nested for loops
2. each view generated, is positioned in the scrollview, and you pass the name of the thumbnail and fullsize image
3. each view has a symbolic link to the main controller
the scrollviewcontroller is pushed into a navigation stack
4. in each view, you have passed the name of the thumbnail, and fullsize image, over the top of the thumbnail which is a uiimageview and uiimage is your thumb
5. upon clicking, the fullsize image is passed through the parent symbolic link to the main controller, new controller is created, fed the fullsize image, and pushed into the stack.
6. clicking back on the navigation controller pops the current controller, and you go back to the main scrollview with all your thumbnails

dont know if this makes sense, or if you have used scrollview or navigationcontrollers, but that is the way i would do it

scrollview means less hasstle in uitableview and trying to customize it
Sorry an but i still dont understand. I have used a scroll view but what is the code i should use to link these small images to the big ones in full screen can you provide me with some code please. cheers
AlexPacteau is offline   Reply With Quote
Old 02-13-2010, 04:16 AM   #16 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

Quote:
Originally Posted by AlexPacteau View Post
Sorry an but i still dont understand. I have used a scroll view but what is the code i should use to link these small images to the big ones in full screen can you provide me with some code please. cheers
i will see if i have something floating around with a scrollview code, and how it works
mr tickle is offline   Reply With Quote
Old 05-22-2010, 01:50 AM   #17 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 2
Default help to create an image viewer

Quote:
Originally Posted by AlexPacteau View Post
Thanks i have done this but how do i get these small thumbnail images to display in large/fullscreen like in the photos app? thanks for your help.

hi, I am new in iPhone sdk development, can anyone help me by giving sample code, how to create an image viewer.
DIOD is offline   Reply With Quote
Old 07-07-2010, 12:00 PM   #18 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 4
Default

Quote:
Originally Posted by mr tickle View Post
you are gonna be better off using a scrollview, it should work like so

1. generate views in the scrollview using nested for loops
2. each view generated, is positioned in the scrollview, and you pass the name of the thumbnail and fullsize image
3. each view has a symbolic link to the main controller
the scrollviewcontroller is pushed into a navigation stack
4. in each view, you have passed the name of the thumbnail, and fullsize image, over the top of the thumbnail which is a uiimageview and uiimage is your thumb
5. upon clicking, the fullsize image is passed through the parent symbolic link to the main controller, new controller is created, fed the fullsize image, and pushed into the stack.
6. clicking back on the navigation controller pops the current controller, and you go back to the main scrollview with all your thumbnails

dont know if this makes sense, or if you have used scrollview or navigationcontrollers, but that is the way i would do it

scrollview means less hasstle in uitableview and trying to customize it
Hello, I am a newbie,
do you have any sample code of this algorithm.
Basically I need the similar thing. I need to create a scrilable view of thumbnails and clicking on them show me the full size of the image.
but dunno how to create array of thubnails....
shv_rk is offline   Reply With Quote
Old 07-07-2010, 02:53 PM   #19 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

to all those wondering how it is done

www.de-clunk.com/demoScroller.zip

here is the demo file, it may have leaks, im not sure, i put it together in 5 mins, so take a look and use it how you want

this is a window application, so for those who are not sure about window based app, this could be a good place to start

1 thing, when you run the app, have the console window open, i didnt finish the popup with the large image, you guys can do that.

you will see it trace out the corresponding large image name

enjoy
mr tickle is offline   Reply With Quote
Old 07-07-2010, 06:19 PM   #20 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

newer version, this one has the zoom in full image that shows

http://www.de-clunk.com/demoScrollerFulview.zip

enjoy

and any questions, post them on this thread
mr tickle is offline   Reply With Quote
Old 09-18-2010, 01:42 AM   #21 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 9
Default

Quote:
Originally Posted by mr tickle View Post
newer version, this one has the zoom in full image that shows

http://www.de-clunk.com/demoScrollerFulview.zip

enjoy

and any questions, post them on this thread
Cool stuff mr tickle.. Thanks for sharing!
I wonder how hard it is to make the fullview into a scrollView aswell, so you could slide from image to image horizontally (like the native photo album app)

I have tried to create a photo gallery for some time, but got struck in the process of figuring out how to specify which image the user picked, what the previous image and next image is, so the scrollview would be able to load these for the user to slide through the image gallery.

Like this one: (source code for sliding)
iPhone sample code: SlideShow

how to combine.. ?? :O
viezel is offline   Reply With Quote
Old 09-18-2010, 07:06 AM   #22 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

Quote:
Originally Posted by viezel View Post
Cool stuff mr tickle.. Thanks for sharing!
I wonder how hard it is to make the fullview into a scrollView aswell, so you could slide from image to image horizontally (like the native photo album app)

I have tried to create a photo gallery for some time, but got struck in the process of figuring out how to specify which image the user picked, what the previous image and next image is, so the scrollview would be able to load these for the user to slide through the image gallery.
thats not difficult either.

first off, look at the key parameter you have here

image name

so, we can say that you insert a scrollview in the fullview, and you do something like the following.

1. send the image name to the fullview class
2. the fullview class needs access to the full array of images available. You might think of sending it through with the call to initiate the class as another parameter.
3. insert your full image into the scrollview, increasing increments for the horizontal location inside the scrollview, call it xpos
4. here is the cool part. repeat through the image array, comparing the imagename you have with the entries inside the imagesArray, if it doesnt match, something like :

if(![myImageName isEqualToString:[[myFullImagesArray objectAtIndex:yourRepeatVal] objectAtIndex:thepositionofImageName])
{
// increase the xpos by the width of the screen
//insert the image
}

else
{
// you just found the image the user selected, do nothing and let the for loop skip to the next value and dont increase the xpos value
}

this should mean that the first image in the scrollview is the image you selected, and all images after are in the same order, just missing the image selected in the thumbnail view. Turn on paging in the scrollview, so you can stutter skip through them.

that should do it

i can take a look at the demo i created and see how quick i can do it, im swamped at the moment, but not with iphone, php sql and stupid websites

ahhhhhhh iphone dev, my favourite.....
mr tickle is offline   Reply With Quote
Old 09-18-2010, 12:11 PM   #23 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 9
Default

Quote:
Originally Posted by mr tickle View Post
i can take a look at the demo i created and see how quick i can do it, im swamped at the moment, but not with iphone, php sql and stupid websites

ahhhhhhh iphone dev, my favourite.....
Yeah, that would be great!

Actually, what Im doing is having a tableview populated from a rss feed with galleries. when a row is pressed, I want the thumb view of a specific gallery to be visible.
Its here your code comes into play. Receiving an array of images from the tableView, and you are the expect in the rest

Thanks for talking your time to help me out!
viezel is offline   Reply With Quote
Old 09-19-2010, 07:43 AM   #24 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
Default

Quote:
Originally Posted by viezel View Post
Yeah, that would be great!

Actually, what Im doing is having a tableview populated from a rss feed with galleries. when a row is pressed, I want the thumb view of a specific gallery to be visible.
Its here your code comes into play. Receiving an array of images from the tableView, and you are the expect in the rest

Thanks for talking your time to help me out!
well, thats also not difficult to change the format.

i mean, your table view will be easier to handle inside a navigation controller, so you push uiviewcontrollers into it, the stack should have this workflow

[rss table controller] > [thumbnail controller] > [full view controller]

all this is sat in one main controller, say "appController" it actually makes things easier, because appController is responsible for pushing and popping all of the controllers onto the stack, so you will find it easier to pass on the parameters to the nested controllers inside the navigation controller, usually from inside a controller, pass back messages using nsnotification if need be.

i will try to take a look at the demo i currently have, and see how easy it is to show everyone how to do it.
mr tickle is offline   Reply With Quote
Old 12-18-2010, 10:25 PM   #25 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 4
Default Some help

Thanks for this sample code. Is there a way to generate 4 columns in the code below. I have been playing around with this and can't figure it out. It surely can't be hard! And is it easy enough to link a page instead of a photo? Thanks in advance.
---------------------------------------------
Originally Posted by mr tickle View Post
ok, go here, and download the zip

its a solution i did for a post on another thread

http://www.de-clunk.com/buttonsGalore.zip

in there, the 2 classes you want to focus on are maincontroller.h and .m and button.h and .m

in button.h, i make the class maincontroller available to button.h
@class maincontroller

and then i declare a property

maincontroller *parentLink;
and
@property(assign,nonatomic)maincontroller *parentLink;

this creates the pointer, but it only knows that its of the class maincontroller

now, in the maincontroller.m file, i say obj.parentLink = self;

so when i generate the UIView object, im telling it that i want to create a symbolic (thats what i call it anyway) link back to mainController

this means, from any uiview that is generated in maincontroller object, i can reach back and run its methods, there fore creating the link.

when you build and go in the buttonsGalore project, click one of the buttons, it traces in NSLog (look at the console) showing that a method from the mainController was run, and was called in a subview.
nudibranch is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 351
19 members and 332 guests
ADY, Alsahir, Dani77, e2applets, JasonR, keeshux, mer10, Monstertaco, piesia, prchn4christ, Promo Dispenser, Robiwan, sebasx, sly24, Touchmint, twerner, zulfishah
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,759
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:27 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0