alekseyn / EasyTableView

Horizontal and vertical scrolling table views for iOS
BSD 3-Clause "New" or "Revised" License
584 stars 157 forks source link

Using images instead of text #9

Closed kimg closed 12 years ago

kimg commented 12 years ago

I wonder if it is possible to use an image instead of the numbering in the scrollers.

does take some kind of rewrite to do so?

br kim

alekseyn commented 12 years ago

Yes, you can put whatever you want in the view you create in the easyTableView:viewForRect: delegate method.

kimg commented 12 years ago

Ok, I can add a picture but then i miss a label beneath the picture. i've been experimenting to see if i can get a picture and below the picture a very short text.

i see the label and it has the correct height ans so on. but the picture never shows. i guess i have to add the two components: the picture rect and the label. but i can't get it to work. do you have a suggestion. sorry to bother you again...

kim

alekseyn commented 12 years ago

Create a container view and put the label and image view in the container view. Do not add the imageView as a subview of the label. Also, you have a memory leak. Replace borderView = nil; with [borderView release];

kimg commented 12 years ago

another practical problem: is it possible to have different images in the scroll cells? as far as i can tell viewForRect is the place where the layout of the cells is done. but assume that i have 21 different pictures i'd like to scroll through - i can't see that the function is called pr cell. am i wrong?

kim

alekseyn commented 12 years ago

You would set different images to a UIImageView object in the cell's view hierarchy. If you already have all of the images local to the device, do this in the delegate method:

Otherwise, if the images are being loaded from a remote URL, set the UIImageView object in the cell's view hierarchy using the following method:

You should know what the index value is from your own image loading logic.

alekseyn commented 12 years ago

kim,

I updated the project with an example of how to use EasyTableView to display images loaded from a remote server, Flickr in this particular case. Just tap the info icon. You may need to do it a few times if you receive an error.

Aleksey