How can I create photo thumbnails? - iphone

How can I create Photo Thumbnails like this?

For creating thumbnails have a look at the category presented here:
http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
And for the view, just make your own UIScrollView, or use a UITableView with several images per table cell. There are also some (sometimes quite big) packages around you can use, like this here - they have the full functionality of thumbnail views:
http://three20.info/

You can simply create a UIView and place UIImages in it. The ammount of images should be computed depending the hardware (iphone, retina, ipad, etc)
There is no ready-made view to stack elememnts (UIImages) like in the c#

Related

Using an Open Cover Flow for video slides instead of images in iOS

Can you have a Cover Flow of multiple videos instead of images in iOS? The user would see a still of the start of each video with the play button instead of images, kind of like Youtube.
So instead of a set of images like the current Cover Flow in iOS, it would be a set of videos. Or Videos and images mixed up.
iCarousel is the framework I would use in this case. It is a CoverFlow replacement library, as CoverFlow is an undocumented API under iOS. See the description on the GitHub site and read the note below.
Unlike many other "CoverFlow" libraries, iCarousel can work with any kind of view, not just images, so it is ideal for presenting paged data in a fluid and impressive way in your app.
I haven't tried it myself with video objects, but from the documentation and this, it would seem you can pass in video objects or thumbnails that when clicked, load a video. Performance-wise, thumbnails would make much more sense. Below is source code from the readme with explanation for how to use it.
The iCarousel follows the Apple convention for data-driven views by
providing two protocol interfaces, iCarouselDataSource and
iCarouselDelegate. The iCarouselDataSource protocol has the following
required methods (note: for Mac OS, substitute NSView for UIView in
method arguments):
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel;
Return the number of items (views) in the carousel.
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view;
Return a view to be displayed at the specified index in the carousel. The reusingView argument works like a UIPickerView, where views that have previously been displayed in the carousel are passed back to the method to be recycled. If this argument is nil, you can set its properties and return it instead of creating a new view instance, which will slightly improve performance. Unlike UITableView, there is no reuseIdentifier for distinguishing between different carousel view types, so if your carousel contains multiple different view types then you should just ignore this parameter and return a new view each time the method is called. You should ensure that each time the carousel:viewForPageAtIndex: method is called, it either returns the reusingView or a brand new view instance rather than maintaining your own pool of recyclable views, as returning multiple copies of the same view for different carousel item indexes may cause display issues with the carousel.
So for the second method, you could implement a UIImageView that was a thumbnail for the video, and reuse a view each time for each video. The upside of this is that you could mix images and videos, differentiating only when you needed to display the image/video fullscreen. And it would be as simple as querying the class, then setting up a different view to be displayed based on the class. Is that enough info? Tell me if something isn't clear.
Why not use thumbnail images to represent the videos? When the image is pressed, the video loads. This would make the application use less processing power, and allow integration with current iOS cover flow methods.
If you really want to make a video cover flow, you would probably need to write the code to create it from scratch. I would think that it is possible though.

iPhone - Create an images grid list

I'm developing an application that get images from a website and display to user with a grid view like Photo app by Apple.
When you tap on an image I would to push a view controller that displays images info and other stuff.
What's the better way to implement this? I thought a custom UITableViewCell. (I've seen there are Three20 and AQGridView libs but I'm a newbie developer and the docs are very very poor. Hints?)
Thanks.
I think the UITableView is the best way of doing it. Its memory efficient and your only going to display 3 images anyway so the overhead isn't that bad. A tip, when your asynchronously getting images from the website, create a custom view is a delegate of NSURLRequest, get the data from a webpage, parse the data into a UIImage using imageWithData and when the finished delegate method is called, put a imageview on top of the custom view. This is the best method of downloading asynchronous methods. Good luck!
I made a thumbnail grid list like tableView but multicolumn, it's open source, on
http://www.cocoacontrols.com/platforms/ios/controls/thumbnail-list-view
https://github.com/mohammedDehairy/ThumbnailList

how to create an interface like facebook/loopt

I am trying to make an application that have the looks of
or
How can I do it in iphone using objective-C? Is it just a view that has a bunch of images?
I was just wondering why only loopt and facebook uses these kind of view, while other such as foursquare, twitter, gowalla, etc.. doesn't use it? Is it because these kinds of views are hard to implement?
A very simple and straightforward way would be to have a background image that has all the button images and the just overlay square-ish buttons. (Quick 'n nasty).
If you want a more proper approach (and to be able to add the wiggling effect) then you're going to have to have distinct buttons with custom views (the actual images).
Notice that both apps use a UIScrollView to lay each page into. So from a hierarchical perspective you have:
navigationController.view -> UIScrollView -> UIView (container for each page) -> UIButton (with custom views done using UIImageViews) and optionally UILabels underneath each UIButton
How can I do it in iphone using objective-C? Is it just a view that has a bunch of images?
basically — yes.
But at least the Facebook App was made using Three20.

Lazy loading of subViews into a non-paging UIScrollView

I am trying to implement a filmstrip-like UIScrollView that will be populated with thumbnails of catalog pages. Selecting a thumbnail image will cause the main UIScrollView to move to the selected page. The Catalog may contain 100 - 200 pages, and I want to load them lazily only when required.
I have done this in a UIScrollView with paging enabled, but haven't seen anything on the best way to do this in a non-paging scenario. There will be 6 thumbnails visible in the UIScrollView (+ 1 when the view is being scrolled) at any one time. I want to dequeue and reuse the thumbnail's UIView when the view is scrolled, as I am doing in the main UIScrollView (which is a paging scroll view).
Thanks -
Jk
I am also going to suggest you take a look at some sample code of Apple, that is, Photo Scroller. If you are a registered iOS developer, you should also take a look at the WWDC10 session about scroll views in iPhone applications.
http://developer.apple.com/library/ios/#samplecode/PhotoScroller/Listings/main_m.html
What you need to do is mimic the behavior of a table view (which is nothing more than a subclass of UIScrollView). What you should mimic is the reuse of the cells. It is pretty easy to implement and will dramatically reduce the memory foot print of your application since you only load the content that is currently visible in the scroll view.
I hope this helps.
Check out the scrollview suite sample code from apple. The tiled example can probably be repurposed very easily.
http://developer.apple.com/library/ios/#samplecode/ScrollViewSuite/
Check out this class..it may proove helpful..
VSScroller

Adding UiImageView to UiScrollView one at a time... but how?

My problem is that my 300 images are being added to UiScrollView and shows up after it's done finishing with addsubview: calls.
How do I set it up so that it adds a subview, who's up on the Screen .. and continue adding ?
You could add to UIScrollView only first couple of pictures that fit the screen and then add others on request, when user scrolls you have to check bounds and add new image if it would be displayed.
I'm not sure about the code details though.
I know for a sure that UIScrollView with 3 images are shown in demo in the lecture 8 (including source code) at Stanford's CS193P course about iPhone development, the presenter (a guy from Apple) mentioned in the video (on iTunesU) that you could load up on demand other images - he just gave general pointers not the actual solution.
But if you need to display screen full of icon size images (kind of like iphone image library) maybe it would be better to try UITableView (I haven't used it for that purpose yet but give it a try).
stefanB's answer is a good one. For the code details, I'd suggest you take a look at - [UIView drawRect:]. Given the size of each of your rows, you can easily calculate when the passed rect represents a new cell being brought into view due to a scroll, and then update with the new image accordingly.
Have you thought about putting your images not in a UIScrollView, but in a UITableView and having that handle all the caching and lazy loading for you? It sounds more specialized to handle what you'd like to do.