Link from an HTML file to a view - iphone

I have an HTML file that's loaded from a UIWebView. I'm looking to do the opposite - link from the HTML file to a different view controller. How would one go about doing this?
the html file is a local file within the app.
thanks for any help.

You can do this by adopting UIWebViewDelegate protocol and implement the webView:shouldStartLoadWithRequest:navigationType: method. Here you can capture all requests and selectively use them for your purpose.
Define links such as yourapp://yourviewcontroller/argument within the HTML page and parse them in the above mentioned delegate method and load the appropriate view controller.

try using three20 library
https://github.com/facebook/three20
there is a helpful class for this named TTStyledText which render html as well as custom links. just need to map the links with ur controller. Go through the samples in three20!

Sorry for the short answer, but there are a lot of parts to this. Check out this link.
http://forums.macrumors.com/showthread.php?t=463491
It looks like you might have to register the url with Apple. I know that for the maps application its able to do urls like map://... and I've seen other apps do it too, I just don't know the exact process.
Update: looks like this exampe from Apple should help.

Related

Swift and Parse - PFQueryTableViewController loadingViewEnabled

Good day! I'm using Parse for my swift project, Specifically the PFQueryTableViewController but i want to change the loading view when i open the app. It doesn't look good in my background so i want to change its color and shadow. Also its UIActivityIndicatorView. Is it possible to change this things? Here is the Screenshot for it.
I tried searching for that method in ParseUI framework but i can't find it. I hope you can help me, Thanks!
Only the table controller is unique to Parse. The spinner is just a regular UI element. Thus, the iOS developer references are good places to look for this.
Try this link for the activity spinner:
This link shows information about the controller, which shows that it simply inherits from UITableViewController, and the cells/background can be styled accordingly.
In general, Parse tries to prefix its objects with PF.

Javascript and objective c

I want to show a popover view on top of a webview. And the popover should be shown on selecting any UI element in webview. I am able to capture the touch event in a Javascript code . Can anyone help me.. Is it possible to post a notification event from the Javascript..? Is there any other way of achieving this..?
Thanks.
This is exactly what PhoneGap does. The idea behind it is that in response to the touch, your JavaScript loads a particular URL, possibly with a custom scheme. The web view delegate's -webView:shouldStartLoadWithRequest:navigationType: method is called before the web view actually makes the request. If the implementation of that method recognizes the URL, it can then take whatever action it likes, such as displaying a popover view.
You can easily call your scripts (with in the sandbox) from your objective-c methods. Thw Web kit has the methods for evaluating Script codes [webview stringByEvaluatingJavaScriptFromString:#"myJavascriptFunction()"];Check this tutorials to learn dig deeper Tutorial-1 and Tutorial-2.. hope this helps you...

Woodwing: how to trigger the ModalViewController using custom web/html embedded content

Using Woodwing, we have a page that has custom html in it, using the custom web widget.
That widget has an anchor tag, that when tapped, opens a page in safari.
However, if we create the same page using the HTML widget, and a link overlay, that triggers a ModalView to display.
I'm assuming this has something to do with WoodWing's (un)documented protocols for the anchor tags, that are captured by the WoodWing shell application and used to trigger the "ModalView" display. Since everything in Woodwing generates an XML that is parsed when the app is loaded, and I've done numerous applications, this seems reasonable. However, there is very little technical documentation.
My question is: does anyone know any documentation on those protocols, or a way I can use custom-html to trigger the ModalView? I've tried replacing "http" with "ww" but no dice. It's possible it's javascript but I'm suspecting protocols...
The UIWebViewDelegate defines the webView:shouldStartLoadWithRequest:navigationType: method that your view controller can implement. In this implementation, your code shoudl decide if it wants to handle the request (user click) or let the UIWebView handle it normally.
For displaying a modal as a result of a click, this method would display the modal and return NO.
The default HTML widget implementation doesn't support this out of the box. There are two ways that you can do to achieve this;
Implement what they call a 'custom object'. They documented this feature, if you have access to their documentation this should be relatively easy to figure out. It allows you to write native objects and inject them into both the .ofip format and the application.
Implement a modal dialog within the widget (in HTML). This is less convenient but possible to do (if you have a fullscreen widget).
Create the specific URL for open as you mention in your comment(ww://string.string).
Then in UIWebView Delegate method (webView: shouldStartLoadWithRequest: navigationType:) get the redirect URL. If redirect URL is equal to you mention before then perform your action.
Let me know if this answer help you.
Thanks,

Making a UIWebView accessible

Simple question.
I have a UIWebView. It displays plain html text with a few headers. I want VoiceOver to read the content of this web view.
It would also be nice if I could make use of VoiceOver's rotor to let the user scroll through content using headers, but I won't get greedy yet.
Any input is appreciated.
What I have learned: If the view that the UIWebView is contained in is marked as accessibility enabled then voiceover will not pass through to the UIWebView.
UIWebView should be accessible with VoiceOver without you doing anything.
read this one :
http://arstechnica.com/apple/guides/2010/02/iphone-voiceservices-looking-under-the-hood.ars/
From the iOS developer documentation for accessibility.
A user interface element is accessible if it reports itself as an accessibility element. Although being accessible is not enough to make a user interface element useful to VoiceOver users, it represents the first step in the process of making your application accessible.
You can do something like this (or manually set a label):
[_view setIsAccessibilityElement:YES];
There is a lot of information here. I suggest that you consult this.
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html#//apple_ref/doc/uid/

iOS - QuickLook - How to open an object in QuickLook without a UIScrollView

Could anyone point me towards a resource which uses QuickLook to open a (preferably but not necessarily a pdf) file without using a UITableView?
I do have this example of using QuickLook but it uses a listview which I need to get away from.
http://robsprogramknowledge.blogspot.com/2011/02/quick-look-for-ios_21.html
I'm not sure how you plan to design your UI to open a file. I've used a few different ways, so I'll toss out some ideas. A UITableView is ideal for large amounts of files. A generic scroll view can also be used for a large number of files. I've used an alert view for an app that only generates one or two files. You could also use a view with document icons like the iPad Mail app. To get the document icons, use UIDocumentInteractionController. The WWDC 2010 DocInteraction sample code goes in great depth with how to use UIDocumentInteractionController.
As for opening the file, the Quick Look framework makes that easy. A simple, self-contained solution is to subclass QLPreviewController. Then, your subclass needs to conform to the QLPreviewControllerDataSource protocol and optionally the QLPreviewControllerDelegate protocol. Next, pass it an array of NSURLs pointing to your files. You can do this either through an initializer like -initWithFiles:(NSArray *)files or through a setter. From here, -previewController:previewItemAtIndex: just needs to index into the array to get the appropriate file to show. -numberOfPreviewItemsInPreviewController: just needs to return the size of the array. Once you have this class finished, you can use any UI design you like to push this view or present it modally.
Hopefully this is more clear than my tutorial you've been reading.
EDIT:
I have posted some code to Github that may help you. I have created a file previewer class as described above. I also posted a demo app that directly uses a QLPreviewController.