I have searched all around but I still don't understand how I can create a working native plugin to open and use the photo picker on the iOS.
I have also tried the Native Toolkit available from asset store but I still don't know how to do it. I'm not experienced with xcode.
I would really appreciate any ready code snippets or steps on how to do it exactly.
PS: I do not wish to buy any plugins because I only need this single function.
Ok, so I need a system update to look at my old code that did this so I'm going to tell you from memory and you can come back if I missed something. Let me also say this is a good opportunity to create you main menu in Interface Builder as well since you will need a view controller.
First, let's give a real brief explanation of some important UI things in Xcode. You have the UIApplication. This is the class that manages all the states in your application. The UIApplicationDelegate Protocol (protocols in Obj-C are similar to interfaces in C#) has a list of messages that will be sent to any class that implements it. The application has all the windows known as UIWindows that are responsible for distributing messages to the various views on the screen. These UIViews are spaces on the screen. If you've ever used Photoshop, the whole piece is like the window and the layers are like UIViews. That example isn't perfect since you can have multiple windows, but it gets the idea across.
Now its time for the UIViewController. ViewControllers are managers for views. The control when views appear, how views transition, and manage more complex features. The specific view controller you will need is the UIImagePickerController. It takes your current view controller and hides it while displaying its own on top of it. It's important to note that the Unity app doesn't create a view controller. Everything is done in the Unity Engine. It doesn't change views or have any transitional behavior so it never creates a view controller. What's this mean for us? We have to create a view controller and assign the Unity view to it.
So let's go through the steps you will need to take to get here.
I don't know what else you want to do with the image so I can't go to much further than that. That's a basic guide on how to bring the UIImagePickerController into your Unity plugin. I'm pretty sure there are a few mistakes. I haven't done this in a while, and as I said at the top, I can't get into my old files right now. Most of the problems come from the Unity view. the Unity view is a GL view. Simply put, it wants to control the screen. It will sometimes draw itself over other views even if its below them. But I'll try and fix those as you come across them. For now, this should keep you busy for a little while.
answered Sep 11 '11 at 01:09 AM