May 14, 2009
UIWebView and Native Footers
At the request of a couple of QuickConnectiPhone users I have been playing around with a way to combine native footers and/or headers with the UIWebView and specifically the QuickConnectiPhone framework.
I am pleased to say that I have something that should make this easy. As of the next release of QCiPhone you can create native, Objective-C based footers and buttons for the footers. You can also hide and display them and the UIWebView containing your QCiPhone application will be resized so that the footer doesn’t cover any of your display. When you hide the footer the UIWebView expands to fill the space made available by not displaying the footer.
Here is a snapshot of the QCiPhone example app without the footer displayed.
Here is the native footer being displayed.
footer = new QCNativeFooter(‘mainFooter’, ‘black’, false);
var lineButton = new QCNativeButton(‘line’, ‘Line’, ‘displayName(“Line”)’, false);
var pieButton = new QCNativeButton(‘pie’, ‘Pie’, ‘displayName(“Pie”)’, false);
var barButton = new QCNativeButton(‘bar’, ‘Bar’, ‘displayName()’, false);
var imageButton = new QCNativeButton(‘image’, ‘puzzleIcon.png’, ‘displayName(“Image Button”)’,true);
footer.setButtons([lineButton, barButton, pieButton, imageButton]);
The QCNativeFooter constructor is defined as in this following line of code.
function QCNativeFooter(uniqueId, color, translucentFlag)
It takes three parameters
- A unique identifier for the footer. You can have as many footers as you wish.
- The color of the desired footer as a string. The iPhone options are ‘black’ and ‘standard’. Standard is blue.
- A boolean flag indicating if the footer should be semi-transparent.
The code to display the footer is seen here.
It is all that is needed to display the footer and automatically resize the display of your application. To hide the footer simply call
To change buttons being displayed all you need to do is call the QCNativeFooter object’s setButtons method and pass in an array of buttons that you want to replace the old ones. The first code snippet in this posting has an example of this call.
These methods and objects are just facades for calls to Objective-C using the QCiPhone framework. A complete description of all of the Objective-C executed for these calls would be to large for a blog posting.