Using UIImagePicker in a tabbed UIPopover - ipad

I am developing an iPad app that needs to have multiple image sources, on the device/Photo Albums, remote and some included with the app. Now the ideal situation would be to have a UIPopover controller with 3 tabs for each source. The only problem is I can't seem to figure out how to have a UIImagePicker be in its own tab. What I am trying to do is very similar to Apple's Keynote for iPad. The photo icon's popover has tabs and the far left tab called media for sure has a UIImagePicker in there. I have no idea how they did that, is it possible for me to do something like that? I think the main issue is that the Image Picker is it's own navigation controller and it cannot be pushed on to another navigation controller. Any help would be greatly appreciated!

check out this - https://github.com/key1jp/ELCImagePickerController
you can implement it with custom asset library

The built-in image picker is no good.
Create your own image picker and add it to your navigation controller as a normal view. Start from either the Matt Tuzzolo or the MyImagePicker from the WWDC 2010 sample code. Note that you probably want to add image and video preview - I copied the image viewer from MyImagePicker and added a 'add' or 'remove' button to it, and the same for video.
Your image picking is in two steps, one for selecting the group, and one for selecting the assets within the group. I recommend dividing the first step into a two - if there is only one, then go directly to that group, i.e. when you have found the first group, check whether that group was the last (block stop argument). Then push the right view controller.
Obiously modify the size of the thumbnails also, they are iPhone size now. Adding a line of metadata (icon and duration) looks much nicer and is more informative for video.
I also recommend adding a 'click-and-hold' function for extended information after like 2 seconds.
Handle different sources by creating a protocol which gives you what you want, i.e.
-(BOOL)isImageAtIndex:(NSInteger)index;
-(UIImage*)thumbnailForUndex:(NSInteger)index;
-(void)setSelectedAtIndex:(NSInteger)index;
Creating a source which handles local files, included resources and assets is perfectly possible - I use NSURLs and check on the url scheme.

Are you not using UITabBarController for your tabs? You should be able to add a UIImagePickerController directly to viewControllers. I'm not sure whether that is a supported use of the image picker, though; the documentation only mentions displaying it modally or displaying it in a UIPopoverController.
It's not usually useful to look at an Apple app to find out what you can do with various built-in controls, as Apple allows themselves to use private APIs.

Related

Tabbed iOS WebKit Browser with Swift

In short I am trying to build some typical browser functionalities in a Swift iOS app with WKWebViews (WebKit). I already have a functioning browser based on a WKWebView, which already has a menu bar with a URL input, navigation buttons, a share button, page title etc.
What I am struggling with is creating tabs for the browser. At first this seemed trivial as surely WKWebViews would support this in some way. Well, as far as I can tell they do not (looked at and tried multiple tutorials incl. hackingwithswift, Ray Wenderlich etc. + I checked Apple's documentation + stackoverflow)
This is what I have come up with so far:
1) Creating a new tab/opening a new URL should create a new UIView + WKWebView programmatically (I'll have to make a subclass out of my current browser view)
=> this should create a separate thread for each WKWebView/tab according to Apple's documentation
2) I need something like a Collection View (or Stack Views etc.) to store screenshot images of the already open tabs as a preview page of all tabs. The cells should be linked via a delegate to the corresponding WkWebView and they should have a close button to close (= delete) the tabs.
Am I overthinking this? If I go down this path I have to find a way to wire up (and subsequently delete) multiple delegates and views to the Collection View dynamically and I have to store & delete screenshots every time the user interacts with the tabs. It seems VERY messy. But given that Chrome on iOS is based on WebKit as of late, it's obviously doable.
How would you tackle this problem?
PS I didn't include a mockup because you all know how the tabs in Chrome, Safari etc. on iOS look like.
EDIT:
I am just looking for a clean and sensible way to add/remove and show the multiple WKWebViews, which are created by opening new tabs - just like in Chrome for iOS or Safari etc.
Ok, I have solved this today :) I will have a main UIView and then multiple WKWebViews, which can be "zoomed in" in order to enter full screen mode. No need for screenshots etc.

How to make my LaunchImage load at the same time as the application?

As the application loads, I want to make an image load at the same time, for example, a line would elongate form either side as the application loads, and when it has finished, the line would have reached its maximum length. I have seen this in a few websites, like rime arodaky for example, but I want to this for an iOS application. I have searched on Google but couldn't find anything!
Does anyone know how to do this?
The launch process if we REALY simplify it to accommodate your question, can be split into two parts.
The first part you do not have any control over, and during which a launch image is shown.and it ends with a delegate call-back on the application delegate called
applicationDidFinishLaunchingWithOptions
The second part is you might have some application specific behaviour which requires no activity from the user but you app still isn't interactive.
You need to implement such a progress bar yourself. There is no built in support for this in any of the app templates in Xcode.
You can only do what you want during this second phase. But you have absolutely no control over the first phase, except for that static non-animated launch image.
I think you can just add a photo as a launch image, launch image is just an image.Then you can add the animation when your first view controller appears.You can fake it this way.

UiImagePicker custom part

in my app and I'm using UiImagePicker also implemented UiNavigationControllerDelegate for some customizations as the delete key and the back button.
When the user browses the images from its library and chooses one, if you AllowEditing is enabled, the image picker shows a screen for cropping the photo ..
At the bottom of this view seems to be a TabBar controller with two buttons:
Choose Cancel and
I wanted to know if anyone knows how to change the text of these buttons ...
Can you help?
There is no supported API that gives you the ability to customize those buttons.
Perhaps the best solution is to find a custom replacement for UIImagePickerController. There may be one on github or Google code.

Use the modal view displayed by UIDocumentInteractionController

I've been thinking about the following possibility:
I am right now developing an app for displaying a different set of files(could be different formats), and use the content of these files to form 1 single file.
Because UIDocumentInteractionController could show content of formats that otherwise can't be viewed by my app(docx for example), wouldn't it be nice that I capture the modal view displayed by this controller and use it somewhere else?
I am wondering how can I access the content of presented UIDocumentInteractionController and capture it.
Any advice would be nice, thank you.
Screenshot - Maybe I could do a screenshot of presentedViewController.view, but the resolution of captured image isn't ideal - limited to the screen resolution and not high enough to be viewed on a computer monitor.

Possible to customize camera and user photo library views?

Maybe this is the wrong place for this (if so, please help guide me where I should ask this). Would it be possible (or even an acceptable iOS practice) to customize:
The screen that shows when a user takes a photo.
The screen that shows when a user accesses their photo library.
Thanks in advance!
Both these screens are provided by the UIImagePickerController class. You can handily customize the screen to take a photo - there's even API for it. You would first set showsCameraControls to NO to prevent the controller from drawing its own controls, then set a value for the cameraOverlayView property to insert your own controls over the camera. Take a look at the UIImagePickerController docs for more.
By contrast, you should not customize the photo library picker - that's a more traditional navigation interface, and Apple hasn't exposed any extra API to customize how it appears. You could (of course) always start poking into the view hierarchy of the controller once it's onscreen, but I think that would be a little more startling to your users than customizing the camera, and is more prone to break if Apple changes the guts of UIImagePickerController.

Resources