iPhone: Custom UIImagePickerController? - iphone

It seems like the built in UIImagePickerController cannot accept sources other than its device camera Roll.
I would like to get the functionality of picking and enlarging pictures within my own app. Also I would like to allow the user to select the pictures and save it into their camera roll (so they can later use it as wall paper)
1) what is the recommended way of building a custom UIImagePickerController that supports what I need ? Is there another built in controller I am missing?
3) Is there a way to take a UIImage and save it to the desktop background of the device directly? Or is it a two step (first save to camera roll), then have the user load the picture from there to save as wallpaper
Thanks in advance!!

At this point, it seems that the only way to build a custom UIImagePickerController functionality is to subclass, and then muck with the view hierarchy directly. This allows you to move, hide, and replace UI elements and access the non-public classes that control the operation of the camera, but as you probably gather, this technique is both unsupported (in that it may, and probably will, break with future updates) and not recommended (in that it may, and probably will, get your app rejected from the App Store if detected).
As far as your second point (somehow numbered 3), John is right: there is no call in the public SDK to accomplish this. You could probably hack something together if you're clever, but remember the warnings in my first paragraph...

Regarding #3) there is no public call in the SDK to save an UIImage to the desktop.
I don't know about the rest of your questions though.

Just today I started a open source UIImagePickerController clone, it is not perfect but it works quite ok. Feel free to fork http://github.com/jeena/JPImagePickerController

Related

iOS - How to show hints for gestures for iOS app?

I have seen some apps where when you launch them for the first time after downloading (e.g. Chrome app on iPhone), it shows you a list of animated gestures on the screen, kind of giving you a tour of the app.
How do I build one something like that? And how does the app know to launch only for the first time after download and not since then? For the second question, I am guessing a "shown=TRUE" value can be saved inside a PList file and checking the value each time when the app finished launching. But I am more curious about the mechanism involved in creating a guided app tour.
You can use transparent and semi-transparent images with a UIImageView, so you can make up an image with arrows and notes and put over the whole screen. You could fade it out when the user taps.
To know if it's the first time running the app, you should use NSUserDefaults instead of a plist; it's much easier, and you should be app to find a quick tutorial on that fairly easily.
Also, you could check around on this site for controls like this one. I haven't used any of them myself, so I'm not sure how much they differ from a regular UIImageView. They look nice though.

UIImagePickerController Subview Alternative

I am looking to integrate the ability to select images from the built in library into an iOS app.
UIImagePickerController seems like the obvious choice.
However, it only works as a modal view controller. For design reasons, the image selection in this app needs to be part of an UIViewController itself.
After some research on the web and searching the StackOverflow archives, it seems I will need to implement my own Image Picker from scratch using ALAssetsLibraryto access the images stored on the device. However this is quite a task (if done well).
Thus my questions are:
1) Is there already an existing library or class (or would someone be willing to share his/her existing code) for this purpose?
2) Alternatively, is there a way to extend the UIImagePickerController to add more interface elements to it?
For some of my own projects, I use the ELCImagePickerController, but this again is meant for modal presentation.
But since it's open source, you may be able to make modifications to allow it to be embedded in the way you want it to be presented.

Create interactive videos in iPad - An app for product demo

I would like to create videos that needs to run on an iPad native app. The app needs to show a demonstration of a product through iPad. It needs to be interactive as well. I know we can do these in Flash, since Flash is not supported in iPad what are my options?
I appreciate any guidelines or hints. Thank you in advance
The easiest way to create interactive videos for iOS is to use Apple's HTTP Live Streaming technology. You have to create a video, embed metadata, play it using MPMoviePlayerController or AVPlayerItem, and then display clickable areas in response to metadata notifications.
Metadata should contain coordinates for the element you are tracking, eg: a dress, and a identifier for the product. You overlay this info with a clickable subview that reveals more information about the product. There are several applications of this kind in iTunes, here is one.
Once you get a working product and weeks-time of videos, the most difficult part is to perform motion tracking with the less possible human interaction. One approach is to use Adobe After Effects, another is to code your own solution based on OpenCV.
Some ideas:
You could use an MPMoviePlayerController with no controls, on loop.
Here's a solution I thought of using interactive HTML popover's over the video:
You could have a data store (say an NSDictionary), with playback times as keys.
The values could then be a custom class, which includes all the necessary data for an interactive popover on the video.
Your custom class could look something like this
#interface InteractivePopover : NSObject
{
NSString *snippetTitle;
NSString *htmlData; // could include links etc.
CGPoint popoverDisplayPoint;
// other styling attributes etc.
}
Now, when a user taps the video, it pauses it at the next 'interactive' point (by looking for the next key after the current playback time), and displays (animates on) all the popups, which you set before to show off different parts of the product.
That class might be your data store, then you create another class to handling displaying, animating, controlling, sizing (etc) these interactive popovers. It would create a UIWebView for the HTML. It would also control direction, and indication of the source point for your popover.
This is clearly very expandable because you could put images, embedded content etc into the HTML for these interactive popovers.
Anyway, that's how I would do it.
Though flash will not run on ipad you can still create apps for it with flash cs5 .

How can I know when the Magnifying Glass comes up in UIWebView?

How I can detect when the magnifying glass comes up in a UIWebView?
Assuming you're writing an app to release on the app store, you can't - the structure of a UIWebView is opaque to you, and you can't drill down into its component parts. Whilst I suspect it would be possible to descend into its structure and figure out exactly what was getting triggered when, you run a very large risk that Apple will change UIWebView's structure in a subsequent OS update and break your app.
So unless you're going outside of the public API (and thus making available through channels other than the app store) I'm afraid you may be out of luck.

Is there a View Controller to show thumbnails like the Photos app?

I am looking to replicate the image gallery view that shows thumbnails, like in the photos app on the iPhone.
Is there a view controller or any examples that anyone can provide to replicate this?
There isn't one provided by Apple. I would recommend looking at Three20. It has a few things with look a lot like the Photos app.
Another option is AQGridView.
Take a look at the video of Session 104 from the WWDC 2010. It's basically a 40 minute tutorial on how to do the photo app.
Bear in mind that allowing users to zoom will greatly increase the space required. If you use CATiledLayers, that is, which, depending on your desired zoom level, you should consider doing.
Oh, and there is source code ;)
What they don't tell you is how they did their tiling. I found that you can
a) download ready-made tiles from the server with the app or with a content update (you can use ImageMagick's crop tileWidthXtileHeight - e.g. crop 100x100 - to do the tiling). This has the disadvantage of large downloads.
b) download ready-made tiles from the server as needed (may lead to lags in your app, but then MKMapView does it quite nicely, doesn't it?)
c) tile on the phone as needed (here you can also consider caching the results, although that will likely mean you have to check space left on the device)
I've recently given enormego's PhotoViewer a try. It's easy to use, and it's much more focused than the Three20 project. (Which I also use and like a lot.)