Quicklook embedded preview - objective-c

From the docs for quicklook:
"The consumer portion of Quick Look
has three components: a document
reader (consisting of a custom view
and panel), display bundles for that
reader, and an SPI to enable
communication with the client. Each of
these components has a specific role
to play in support of the consumer:
Document reader—Quick Look implements
a view (NSView) and panel (NSPanel)
customized for displaying document
previews. Along with the preview
content, the view might include (at
the client’s option) controls for
manipulating the preview, such as
page-forward, page-backward, start
playing, rewind, and text-search. A
client application can embed this view
in its user interface if it chooses.
The Quick Look panel contains a Quick
Look view and various controls that
let the user take some action with the
preview, such making the preview image
full-screen or starting a slideshow."
I have been poring through all the docs and examples for quicklook and I don't see either:
A definition of any sort of "Document reader" component or way to access it.
Any sort of SPI as such that would show how to consumer quicklook
Any direct access to the NSView used by quicklook to display previews.
All I want to to do as the docs say: embed quicklook's view in my own hierarchy rather than in the Panel. The panel of course has abundant documentation. Has anyone successfully used Quicklook in this manner before?

The class you are looking for is QLPreviewView, part of Quartz.framework. It's a public class (introduced in Lion, I believe). Unfortunately, the docs team apparently hasn't yet released its documentation, which is probably why you couldn't find it. The official docs are now available.
The short, short version is that you create it the way you would any other view, and set its previewItem to an id <QLPreviewItem> that you supply. The <QLPreviewItem> protocol is documented. E.g.
QLPreviewView *pv = [[QLPreviewView alloc] initWithFrame:frame
style:QLPreviewViewStyleNormal];
[pv setPreviewItem:item];
[myView addSubview:pv];
[pv release];
That's the basic concept, YMMV.
Its operation is thoroughly covered in the 2011 WWDC session "System-wide Previews on Mac OS X and iOS" (or something to that effect). You should be able to get the video if you are a paid member of either the Mac OS X or iOS developer programs.

Related

How do I notify users of new content available in tvOS apps from the home screen?

Push notifications have been left out of tvOS (understandably so) but the docs seem to contradict themselves in alerting users to the fact that there is something new available in your tvOS app.
Here it seems to say that you can add an app badge: https://developer.apple.com/library/prerelease/tvos/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html
Here it says they've been removed from UIKit: https://developer.apple.com/library/prerelease/tvos/releasenotes/General/tvOS90APIDiffs/Objective-C/UIKit.html
Removed UIApplication.applicationIconBadgeNumber
Assuming the badge approach is not supported in this release, does anyone know the best practice for alerting a user that there is new content in your app without the user taking an explicit action? ie focusing on the app and showing them something in TopShelf?
I encountered the same problem and dived into this. Probably your best way is to update the topshelf with latest items, which is my way to solve this for now. You can use network calls to update the topshelf with content from your backend.
This depends on the type of application. E.g. showing the latest top movies for a movies app.
You can trigger an update of the topshelf after your network call completed using the following code:
NSNotificationCenter.defaultCenter().postNotificationName(TVTopShelfItemsDidChangeNotification, object: nil)
Make sure to implement the TVTopShelfProvider which should be clear using the following documentation:
This protocol is adopted by the principal class of an app’s TV Services extension. Apps that implement this extension can provide dynamic content to the Top Shelf element rather than having the system use the static image submitted with the app. The topShelfStyle property specifies the interface style you want, and the topShelfItems property specifies the content items to display. Whenever you change the content provided by the extension, post a TVTopShelfItemsDidChangeNotification notification to prompt the system to reload your content.
Icon badges are removed for app icons, push notifications as well (except for silent push notifications).

Google Map Integration in OS X Application

I would like to use use Google Map in my MAC application.
I found the iOS SDK of Google Maps but not for OS X.
I want to show two annotation and a line connecting them on Google Map. Coordinate of both annotation are dynamic as per user selection.
Below is the way I find out that can work:
Call a API and pass the location coordinate for both annotation.
Now Server side a html form is generate using javascript and create a page which is showing the 2 annotation and line connecting them.
In Api Response I will get the URL of that html page.
I will show this page in UIWebView.
I want to know is there any other way I can achieve this.
I want to distribute application outside the mac app store and to distribute outside mac store I need to sign app with Developer ID which does not support the MAPs.
I didn't find anything related to this that's why I created this thread.
Thanks in advance.
I recently ported the Mapbox iOS SDK over to OS X. It has a lot of the features of MapKit, but it’s open source and should also work in a developer-signed application such as yours. To use the Mapbox OS X SDK, download the latest release from the GitHub repository (look for releases beginning with “osx-”) and follow the instructions in README.md. An API reference is included.
I want to show two annotation and a line connecting them on Google Map. Coordinate of both annotation are dynamic as per user selection.
To display the annotations on-screen, you’ll need the MGLPointAnnotation and MGLPolyline classes. You can move the point annotations dynamically by setting their coordinate properties. The polyline, however, is immutable; to change its path, remove the existing polyline and add a new one with the new coordinates.
You will have to make it with WebKit and the Google Maps API.
MapKit is available in OS X 10.9 Mavericks: https://developer.apple.com/library/mac/documentation/MapKit/Reference/MapKit_Framework_Reference/index.html
There are of course many ways of hiding the fact that you're using WebKit but if they violate Apple's or Google's TOS then submission to the App Store won't be possible.
Hope this will be helpful!

Library or API for file browser view?

I would like to implement a file browser view in my application so users can open files using a side panel similar to the browsers in XCode, Text Wrangler and some other programs.
Before I go off implementing another one of those browsers from scratch, does anyone know if there are existing libraries or APIs that already does this?
Google doesn't turn up with much and most of the searches point me to NSOpenPanel which I believe doesn't do what I want.
Thanks in advance.
The Cocoa class that is used to display hierarchical lists is called NSOutlineView.
Outline views provide several configuration options to adjust the appearance.
The content can be provided by implementing a data source protocol or via Cocoa bindings.
Apple has some sample code online that should get you started (it's a file browser - so maybe you can use larger parts of that sample):
https://developer.apple.com/library/mac/#samplecode/SourceView/Introduction/Intro.html

Create custom templates in iOS ap

How to create custom templates in iOS app having uiimageview ,uitextview,and many other views so that user can select any one template and starts editing it.
There is a famous library thats floating around for this kind of usage - iOS BoilerPlate
It is intended to provide a base of code to start with
It is not intended to be a framework
It is intended to be modified and extended by the developer to fit their needs
It includes solid third-party libraries if needed to not reinvent the wheel
What it includes -
HTTP requests and an image cache (both in-memory and disk-based)
UITableViews and UITableViewCells: fast scrolling, async images, pull-down-to-refresh, swipeable cells,...
A built-in browser so your users don't leave your application when they browse to a certain URL
Maps and locations: directions between two points, autocomplete a location, etc.

Using a UIImage as the application icon

Is possible to set an image as an iPhone application unique icon in code instead of adding a PNG format image file and naming it Icon.png?
a) No, not for developer applications. Also note that Apple's preload applications can demonstrably alter Default.png (see the Notes app) but that can't be done by the rest of us.
b) The app icon can also be a jpeg and can be called whatever you like - you just need to set it appropriately in Info.plist
Here is an example of what you would add to your Info.plist:
<key>CFBundleIconFile</key>
<string>app.png</string>
This (as well as other related options) is well documented in the iPhone Application Programming Guide.
Note: you may need an Apple Developer account to see that link.