Sharing images between iOS8 containing app and Custom Keyboard - ios8

What is the best way to send images between the containing app and a custom keyboard?
is there a best practice that apple talk about?
is there a hacky way that apple will hate?
is there a framework already that somebody built in github that helps this?
thanks!

You can save images in NSUserDefaults, see Save images in NSUserDefaults? . And since you have access to NSUserDefaults from the keyboard and the app, it works. See my answer in Can a custom keyboard extension identify a user of my companion application in any way? .
Note that in order to enable the sharing of a defaults container you have to follow Apple's docs in the App Extensions programming guide.
It's a very simple and effective solution, but I would only recommend it for a few very small images like icons, etc... Don't make NSUserDefaults a repository for your camera photos!
If you want to do more complex data sharing, I would contend that a custom keyboard is probably not the correct structure.

Related

Extract image resources from Mac's builtin applications

Just an example, Apple's Mail, Notes and Messages use the same image for their "Edit" button. However, I cannot find that image in any of the resources folder in their app bundles. I guess the image might be in a system folder that is used by these applications. There are many "common used images" like this one that are not in Xcode's media library. Since they are already familiar to the users, it makes sense to use the same image set in my own app.
My question is, where can I find those images? A side question, is it legal to use them?

How to include iOS8 extensions when using a custom share UI?

There is any way to access sharing extensions without popping the default UIActivityViewController?
I couldn't find one, but asking just in case.
In case not, i have another question.
How are you planing to adapt your app's custom sharing interfaces to this restriction?
You cannot access Share/Action extensions without using UIActivityViewController. In iOS8 sharing area of the activity view controller is the only entry point for share extensions.
From Apple docs.
Each of which is tied to an area of the system, such as sharing,
Notification Center, and the iOS keyboard. A system area that supports
extensions is called an extension point. Each extension point defines
usage policies and provides APIs that you use when you create an
extension for that area. You choose an extension point to use based on
the functionality you want to provide.
The best you can do is to provide a share menu with two options to launch app's custom sharing interface and UIActivityViewController. Bad UX but I don't know any other way.

Date time format UI

My app shows many dates/times and I would like to allow user to create its own format using a friendly interface like the OSX system UI shown in image
I can't find any cocoa or CF API to show a similar panel, if possible I prefer don't re-implement it from the scratch.
Anyone can point me if this panel can be shown from standard API or if exists a ready to use component?
You're looking for NSTokenField, though you will need to do some modifications to make it work for your case.

How to make or use a standard Image Viewer for WP7

I want to make an app that shows pictures. But I want to be able to zoom in and out with gestures. I fixed this by including a toolkit into my project. But my actual question is, can I use or is there a control that's already created for me to show pictures like the picture library of the WP7 phone itself. I thought there wasn't but the Facebook app has a similar way of showing the pictures. Did Facebook rewrite the whole thing or is there a control somewhere that someone made?
The SlideView control in Telerik's RadControls for Windows Phone sounds like what you're looking for.
Have you tried a MultiScaleImage control? It's designed to work with multiple layers, but if you only specify one layer, it might suit what you're trying to do.

Is it possible to add custom Data Detectors to OSX Cocoa applications? (such as Mail.app / Safari)

As the title suggests...
Is it possible to add custom Data Detectors to Cocoa apps?
If so, a gentle nudge in the right direction would be great.
Note: To be clear. I want to add new detectors to currents apps. I am not writing a new app.
Thankyou
W
It's not even possible to build a custom data detector on anything but iOS 4. NSDataDetector is only available on iOS 4 and above.
If they existed on OS X and were a plug-in class like Spotlight importers, that'd be a nice feature. Perhaps filing a request at bugreport.apple.com would help it along?
Later update
I think the reason this hasn't been opened up with an API is because they're only meant to find common data (contact info, dates, URLs) for which there is only one (or just a few) uses. That is, contact info can be stored or used in "the" system-designated app. URLs can be auto-highlighted so they're linkable (clicks invoke the system-designated handler - Safari, an app registered to a protocol, etc.). But there's only one direction to funnel those actions and the endpoint is always a major "convenience app" meant to manage this common information (contacts, calendar, browser, email app, phone app...)
On the other hand, consider app-specific information. Data formatted a certain way for use with one app or platform might mean something else entirely to another application. In fact, this is rather common. So what happens when a string like %%SOMESTRING%% is detected? To one app, it might be a placeholder token. To another, it might be a user name. To another still, it might be interpreted as %%USERNAME followed by %%. Suddenly the simple system-wide UI for handling basic data types has to account for multiple actions and/or multiple "data detector plugins" claiming all or part of a format.
I'm not sure we'll ever see custom data detector APIs on iOS or Mac for this reason alone.
While custom data detectors aren't available at the OS level, there is a mechanism that will get you almost there. One possibility is to create a Workflow in Automator and save it in the Services menu.
It can be configured to be active when text is highlighted. You'd either go to the current app's main menu and select the Workflow under "Services", or else right click on the text and go to the "Services" menu from there. Not as easy as clicking on the text as you would a URL, but pretty close.
Create a workflow in Automator on Mac

Resources