June 22, 2010

The upcoming iPhoneDevCon

Posted in Uncategorized tagged , , , , , , , , , , , , , at 2:58 pm by tetontech

I will be teaching three classes at the iPhoneDevCon in San Diego on September 27-29.  You can get a discount admission if you use my discount keyword.  It is BARNEY.  Make sure you use all upper case characters when typing it in.

To register you can go to http://www.iphonedevcon.com

To see what classes are being taught go to http://www.iphonedevcon.com/classes.html#2

I’ll be teaching:

  1. an introductory class on QuickConnect
  2. a medium class on modular iOS development in Objective-C
  3. an advanced class on Objective-C development for enterprise data synchronization

I would love to meet as many of you as possible and get feedback on the roadmap for QuickConnect.  I hope to see you there.

Lee

March 13, 2010

Developing for Blackberry on the Mac

Posted in Blackberry development tagged , , , , , at 5:03 am by tetontech

After attempting to develop for Blackberry on the Mac in several ways I have finally come across a way that works.  Here is how you can get this to work.

  1. Download and install VirtualBox version 3.1.4 or greater.  The earlier versions do not work with the blackberry simulator.
  2. Install WinXP in VirtualBox.  This worked for me.  I have not tried Win7 yet but will in the near future.
  3. From within your Win installation download and install the blackberry JDE 5.0 not earlier versions.  Make sure you get the JDE not the eclipse plugin.

At this point you can use the JDE to develop, compile, and run in the blackberry simulator from within your Win installation.

There is another option.  I am compiling and creating the .cod Blackberry application file inside of Xcode.  I will soon be releasing a version of QuickConnect that has a Blackberry template based on what I am doing now.  At that point we should be able to create one application and run it on the iPhone, Android, Blackberry, and Palm WebOS.  In fact there will be one QuickConnect template that will build for all of these platforms in addition to templates for each individual platform.

After I compile the application and generate the .cod file in Xcode I then place the .cod file in a VirtualBox shared directory.   I can then launch the simulator directly by running the .bat file for the 9559 simulator called 9550.bat.  It is found in the Simulator directory of the JDE 5.0 installation directory.

With the simulator running I select file->Load Java Program and pick the .cod file from the shared directory.  Using the Blackberry simulator I then run the application.

February 4, 2009

QuickConnectLinux Beta 1 is Now available

Posted in Uncategorized tagged , , , , , , , , , , , , , , at 11:50 pm by tetontech

It took longer than expected, but it is here.  QuickConnectLinux 1.0 beta 1 uses the 4.5 version of QT as the support for JavaScript application creation.  Since the QT 4.5 library license is LGPL just like QuickConnectLinux, when the release of QT 4.5 is shipped by Nokia your applications can be created for free or you can charge for them  without any payments or royalties.

The framework access to SQLite databases shipped with the application or created at runtime are both supported in this first beta.

I used Qt creator from Nokia to write the C++/QT back end code.

The nativeDBAccess example application running on Linux

The nativeDBAccess example application running on Linux

Just like the other members of the QCFamily you write your application in JavaScript, compile it, and ship it.  You users can then install the application and run it without access to the internet.  QWebView is the class in QT that contains the WebKit engine and makes all of this possible.  I have attached an image of the exact same HTML, CSS, and JavaScript used in the QuickConnectiPhone nativeDBAccess example application running on top of the QT port of the native framework.

I’ll put the Qt Creator project up on SourceForge as QuickConnectLinux 1.0 Beta 1.

I can now move back to working more heavily on QCiPhone 1.5 beta and then moving the QCAndroid and Mac versions from Beta to release.  After than I will port QCLinux to Symbian.  That should be easy since the Linux Beta now exists.

Progress is being made.

January 18, 2009

Palm Pre and Mojo

Posted in Android Development, iPhone development, misc tagged , , , , , at 2:16 am by tetontech

Well, it looks like Palm has adopted the QuickConnectiPhone approach for their new phone’s SDK.  In fact it is strikingly similar.  Even down to using JSON as the data transfer type between application code and the device.

Hmm….  I wonder where they may have gotten an idea like that?  More power to them.

It sounds like a port Palm’s new phones will be only a couple of days.

Developers —-   Want to get an idea of how to develop for this new system type?  Start working with QuickConnectiPhone or even the recently released QuickConnectAndroid.

In fact, write off of QuickConnect now and you will get an easy move over of your application to yet another device.

Just a reminder, QC is currently available for iPhone, Android and Mac and coming really soon for Linux, Symbian, and Nokia.

I can hardly wait to get my hands on this new Palm SDK.


January 16, 2009

QuickConnect Porting and Development schedule

Posted in Android Development, iPhone development, misc tagged , , , , , , , , , , , , at 6:20 pm by tetontech

I recently got a request for information regarding the planned development and porting of QuickConnect and thought it should be shared here as well.

I am particularly excited about the ad hoc networking.  It will be great when an iPhone, an Android phone, a Linux based phone, macs, linux machines and even PC’s can discover each other and not need to care what the other device/machine is.  Then an application can be anywhere and interoperate with versions of itself or other services on any of the platforms.  And the applications can be written in JavaScript on all of the platforms.  Wow.

The current porting situation is as follows:

  • iPhone: release 1.1.1 available 1.1.2 next few days 1.5 beta in next few days as well
  • Android: beta 1.0 available today if all goes well
  • Mac: 1.0 beta 1 is currently shipping
  • LinuxQT: beta 1.0 in a week or so
  • MobileQT: about two weeks after LinuxQT beta
  • Microsoft porting will happen after the MobileQT port is nearing completion.

The iPhone 1.1.2 release will include access from JavaScript to:

  • device information – OS, device type, UID
  • The iPhone 1.5 beta 1 release will include access from JavaScript to:
  • ad hoc networking and service discovery (Bonjour Networking)

The iPhone 1.5 beta 2 release will include access from JavaScript to:

  • Raw socket networking (access via the synch cable)

The Android 1.0 beta 1 will include access from JavaScript to:

  • Browser and Native SQLite databases via the wrapper
  • AJAX wrapper
  • Vibrate
  • Play Sounds
  • Record and Play Audio
  • GPS data
  • accelerometer data

Android 1.0 beta 2 release will include access from JavaScript to:

  • Embedded Google Maps

Android 1.5 beta 1 will include access from JavaScript to:

  • ad hoc networking and service discovery

The LinuxQT 1.0 beta 1 will include access from JavaScript to:

  • Browser and Native SQLite databases via the wrapper
  • AJAX wrapper
  • Drag and Drop utility if web view supports CSS transitions(experimenting with this now)

The LinuxQT 1.0 beta 2 will include access from JavaScript to:

  • Embedded Google Maps

The LinuxQT 1.5 beta 1 will include access from JavaScript to:

  • ad hoc networking

The MobileQT 1.0 beta 1 will include access from JavaScript to(when the device supports it):

  • Vibration
  • accelerometerdata
  • GPS data
  • Browser and Native SQLite databases via the wrapper
  • AJAX
  • Play sounds
  • Play/record audio

The MobileQT 1.0 beta 2 will include access from JavaScript to:

  • Embedded Google Maps

The MobileQT 1.5 beta 1 will include access from JavaScript to:

  • ad hoc networking

January 15, 2009

Reflections on doing Android development

Posted in Android Development tagged , , , , at 8:52 pm by tetontech

Some time ago after playing with the Android development API and environment I posted that Android looked good from a developers point of view.  After completing the first beta port of QuickConnect to Android I would like to revise that opinion.

The development environment, an eclipse plugin and the emulator, is very unstable.  Not only does it cause my machine to freeze up regularly but sometimes it doesn’t even work correctly.  For example, when i start eclipse and run my application for the first time in the emulator it fails, every time, to actually install and run the application.  So I then I run the application again and instead of using the existing, running emulator it starts another.  I then have to quit both emulators and run again.  Now the application runs.

If this were all I could easily overlook the environment problems but I now have a much bigger issue.  I used the function keys to rotate the emulator to a horizontal position.  Now every time I run my application it crashes before it even gets to my code.  I have rotated it back, quit both the emulator and eclipse, and even rebooted 3 times.  It still crashes.  This is with ZERO code changes from when it was working.  This seems to be, in general, how the development environment has been to work with.  When it does work it is fine but eclipse crashes, freezes my machine, somehow gets in infinite loops, based on listening to my CPU fan, and the emulator is very buggy.

Now to the API and google’s Java Virtual Machine.

Exceptions are not handled well at all.  The VM will crash the application instead of throwing Exceptions sometimes.  When the events are thrown they sometimes have messages associated with them that are retrievable via the getMessage method and sometimes they don’t.  Pattern?   I’ve seen none with either of these behaviors.  If you are going to roll your own VM it had better be rock solid.  Obviously this one is not.

When I first started trying to write code to record audio I didn’t realize that you had to store all files such as these on an sdcard.  When you try to write to the native memory using the MediaRecorder it allows you to make the call and then goes into an infinite loop of reads.  The log file shows this clearly since read errors are reported infinitely.  Hmm…..  Maybe this should not be the behavior.  By the way, I got the same behavior if I tried to store the audio in a directory on the sdcard.  Additional by the way.  You have to programatically create a fake sdcard on your machine and then tell the simulator to use it.  The creation is uses tools outside of the eclipse plugin.

All in all I have to say that the experience has been quite painful.  This becomes especially true when I compare it to my experience in using Apple’s tools to develop iPhone apps.  Even taking into consideration the difficult app signing apple developers have to go through.

Google, if you want to maintain your good buzz with developers maybe you should stop hitting them in the head with bad tools like the ones you have produced here.  Could it be that you just released it to try and maintain some sort of market share even though it was very far from ready?  It seems likely.

November 18, 2008

QuickConnectMac 0.9 beta is now available! Open source Adobe Air?

Posted in iPhone development, mac development tagged , , , , , , , , , , , , , , , , at 9:07 pm by tetontech

I know this isn’t directly iphone related but I thought I would include it here.

QuickConnectMac,an open-source alternative to Adobe Air, is now available in its’ first beta form! Build both Mac and iPhone applications in HTML, CSS, and JavaScript without learning a new language or framework. Now you don’t have to learn Objective-C.

QuickConnectMac includes an implementation of the QuickConnect framework both in JavaScript. If you want to write in Objective-C it also includes an Objective-C implementation.

A custom Xcode template is included in the downloadable zip file to dramatically speed your development. See the installation instructions below.

New additions for the Mac implementation are:

1 – Debug messages created in JavaScript are written to the Xcode’s gdb Console just as if they were Objective-C NSLog calls. This is also true of the iPhone release version.

2 – The JavaScript DatabaseAccessObject now has a boolean parameter that allows it to access SQLite database files shipped in the Resources directory of your application. When the application is started a duplicate of the original database is copied to the user’s Documents directory. This allows the user to ‘reset’ the application by deleting the copy in the Documents directory.
Any number of shipped database or embedded UIWebView SQLite databases can be used. They can even be used together if you want.

3 – Multiple Business Control Functions can now be used on both the JavaScript and Objective-C sides. If the JavaScript BCF’s make asynchronous calls the BCF execution is serialized, not made synchronous. This means that you can make an AJAX call from within a BCF and when it returns a value your next BCF will be called. Again, this is not using synchronous AJAX calls. The same holds true for the asynchronous data access calls to the UIWebView’s built in SQLite database.

Both of these asynchronous calls are handled for you in either the DatabaseAccessObject or ServerAccessObject(AJAX). They both use a common ‘getData’ and ‘setData’ interface to the functionality.

Installation:

Place the ‘QuickConnect Application’ folder in the ‘/Developer/Library/Xcode/Project Templates/Application’ folder and when you select ‘New->Project’ in Xcode the ‘QuickConnect Application’ template will be a selectable option at the bottom of the window when you select ‘Mac OS X’ and ‘Application’

October 30, 2008

QuickConnectiPhone 1.0 Available

Posted in iPhone development tagged , , , , , , , , , , , , , , at 6:19 pm by tetontech

Update!  Many new features and examples available.

QuickConnectiPhone version 1.5  and 1.6 beta, a framework for creating installable JavaScript iPhone applications, is now available on sourceForge.

Included in the download are many examples of how to use the framework.  One is a Dashcode project file that implements an application completely in JavaScript.  It includes using the sqlite database as well as AJAX.

The second example is how to interact with the iPhone or iPod Touch.  This is a JavaScript application that can get the GPS information from the device.  It can also get the accelerometer information.  You can also use it to vibrate the phone and play system sounds as well as record and play audio.

One of the limitations of the UIWebView is that the pickers displayed when the user selects pull-downs in HTML.  This same example shows you how to use the more useful native pickers from within JavaScript.

This same example shows you how to write out debugging messages in JavaScript and have them show up in the Xcode console.  This is very handy since alerts are not allowed on the iPhone and alerts are a bad way to debug anyway.

These two examples are actually the examples from the book I have in progress.  More of the examples from the book will be added to create RC2 as well as any fixes that need to be made.  One of the examples included will be how to embed Google maps in your application that looks like the Map iPhone app.

Other examples cover everything from how to consume data feeds to doing enterprise data synchronization between the sqlite database on the device and ANY remote database.

I am currently deciding what the last chapter of my book should be. A rough cut of the first four chapters is available on Amazon.com. The title is:

Developing Hybrid Applications for the iPhone: Using HTML, CSS, and JavaScript to Build Dynamic Apps for the iPhone. It is being published by Pearson.

If you have any ideas for things you would like to see how to do with the iPhone please post them here.

The books current chapters are:

  • Creating iPhone Hybrid Applications Using JavaScript
  1. Developing with Dashcode and Xcode           – using both apps to create a hybrid application
  2. JavaScript Modularity and iPhone Applications – the QC Architecture explained
  3. Database Access and iPhone Applications       – using sqlite
  4. Remote Data and Hybrid iPhone Applications  – using AJAX
  • Section 2: Creating iPhone Application User Interfaces
5.  Creating an iPhone User Interface                     – Apple’s rules and other good ideas

6.  Hybrid Applications, GPS, Acceleration and

Other Native Functions                                  – calling objective-c from JavaScript and the QC Obj-C implementation

7.  Embedding Usable Google Maps                       – how to insert Google maps in your application so they look like the Map application that ships on the device.

8.  ??????

Appendices
A.  An introduction to JSON
B.  Intstalling the QuickConnectiPhone Hybrid Templates
C.  JavaScript Objects

August 14, 2008

Calling Objective-C from JavaScript in an iPhone UIWebView

Posted in iPhone development tagged , , , , , , , , , , , at 6:47 am by tetontech

Apple now has a new web view class, WKWebView. It is much improved. See this new posting for how to interact with Objective-C from JavaScript and this post for interacting with Swift. The classes and methods are the same for both Swift and Objective-C. (June 13, 2014).

 

The information and source code covered in this posting is included, updated, and made more reliable in the downloadable framework called QuickConnectiPhone. Take a look at this wiki page to learn more more about the built in capabilities and features of this framework. These include GPS, acceleration, and much, much more functionality available from within JavaScript.

The framework uses the approach described below in the original posting but has many features, optimizations, and defect fixes wrapped up for you and ready to use.

 

At long last a methodology has been discovered that will allow calls to be made to objective-c code from the UIWebView. It isn’t as strait forward as I would like but it does work. The example shown here uses it to activate the core location libraries as well as to send messages to NSLog. We all know how hard it can be to find the reasons for JavaScript failures in the UIWebview. This will allow you to do it.

The methodolog uses the UIWebViewDelegate method

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

The post contains an updated version of code from a previous blog post here at Teton Technical. It includes changes that will soon be in the next version of the QuickConnectiPhone framework.

In order to use this methodology a button with an onclick listener has been defined in the index.html file as seen here.

It tells the UIWebView to load a new page called ‘call’ and passes two parameters, a command and a parameter that can be used by the objective-c. In this case it is actually not used but is here to show you how parameters are passed.

Here is the code fragment that contains the objective-c method that is triggered when a location change is requested,the full code for the class containing this method is at the end of this posting. It checks to see if ‘index.html’ is being called.
If it is then it returns YES so that the load will continue. Any other request for a page changes is stopped by returning NO.
It also parses the URL that is the request and retrieves the cmd and any other parameters sent in the URL.
If you were using the QuickConnectOC, Objective-C, library in on the objective-c side of your application you could simply pass the command and parameter array to it and let it handle it for you.
If you are not using the QuickConnectOC library you will need to handle it yourself with conditional statements. Since I have not yet posted the QCOC library, it should be available this week, I have shown how to embed the conditionals statements for doing logging of messages and calling core location functionallity.

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSString *url = [[request URL] absoluteString];

NSArray *urlArray = [url componentsSeparatedByString:@"?"];
NSString *cmd = @"";
NSMutableArray *paramsToPass = nil;
if([urlArray count] > 1){
NSString *paramsString = [urlArray objectAtIndex:1];
NSArray *urlParamsArray = [paramsString componentsSeparatedByString:@"&"];
cmd = [[[urlParamsArray objectAtIndex:0] componentsSeparatedByString:@"="] objectAtIndex:1];
int numCommands = [urlParamsArray count];
paramsToPass = [[NSMutableArray alloc] initWithCapacity:numCommands-1];
for(int i = 1; i < numCommands; i++){
NSString *aParam = [[[urlParamsArray objectAtIndex:i] componentsSeparatedByString:@"="] objectAtIndex:1];

 

[paramsToPass addObject:aParam];
}
}
/*
* if you are using QuickConnectOC within the Objective-C portion of your iPhone application
* you can make the call that is commented out below.
*/
//[[QuickConnect getInstance] handleRequest:cmd withParameters:paramsToPass];
/*
* if you are not using QuickConnectOC you will need to use conditional statements like if-then-else or case statements
* like the example below. You would then use the other parameters passed with the command to make decistions and
* execute code.
*/
if([cmd compare:@"getLocation"] == NSOrderedSame){
[locationManager startUpdatingLocation];
}
else if([cmd compare:@"logMessage"] == NSOrderedSame){
//NSString *message = [[paramsToPass objectAtIndex:0] stringByReplacingOccurrencesOfString:@"%20" withString:@" "];
NSString *message = [[paramsToPass objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSLog(@"JSMessage: %@",message);
}
/*
* Only load the page if it is the initial index.html file
*/
NSRange aSubStringRange = [url rangeOfString:@"index.html"];
if(aSubStringRange.length != 0){
return YES;
}
else{
return NO;
}
}

The JavaScript function, GPSLocation, in index.html that gets called by objective-c is shown below. It shows you how to send messages to be logged by NSLog. This technique should allow you to put any number of debug statements in your JavaScript code and have them displayed in Xcodes run log. This code can be found in the QCUtilities.js file in the soon to be released QCiPhone beta 5 framework.
// the location function call made from the underlying Objective-C framework when the location of the device is determined
function GPSLocation(longitude, latitude, altitude){
window.location = "call?cmd=logMessage&msg="+document.getElementById('messages').innerText;
try{

 

document.getElementById('messages').innerText = 'Longitude: '+longitude+' \nLatitude: '+latitude+'\nAltitude: '+altitude;
return 'It worked!';
}
catch(err)
{
txt="'There was an error on this page.\n\n";
txt+="Error description: " + err.description + "'";
window.location = "call?cmd=logMessage&msg="+txt;
}
return 'It failed';
}

There is no guarantee that these messages will be logged prior to the function shown here returning. In fact it has not happened for me yet. Here is the log file results. You can see that the JavaScript log message appears after the return value of the GPSLocation function has been logged by the method that called it.

2008-08-14 00:05:46.638 RoadRunner2[38029:20b] Location updated
2008-08-14 00:05:46.639 RoadRunner2[38029:20b] GPSLocation(37.331689, -122.030731, 0.000000);
2008-08-14 00:05:46.642 RoadRunner2[38029:20b] done with result: ‘It worked!’
2008-08-14 00:05:46.647 RoadRunner2[38029:20b] JSMessage: Put Messages Here

I hope this helps you all out.

Here is the full code for the updated UIWebView example.
/*
Copyright 2008 Lee S. Barney

This file is part of QuickConnectiPhoneHybrid.

QuickConnectAJAX is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

QuickConnectAJAX is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with QuickConnectAJAX. If not, see .

*/
//the acceleration function call that is made from the underlying Objective-C framework when the device experiences acceleration
function accelerate(x, y, z){
/*
document.getElementById(‘messages’).innerHTML = ‘got acceleration’;
document.getElementById(‘messages’).innerHTML += ‘
session value: ‘+session.getAttribute(‘curAccel’);
*/
var accelObject = session.getAttribute(‘curAccel’);
//document.getElementById(‘message’).innerHTML += ‘
xValue: ‘+accelObject.x+’ new x: ‘+x;
accelObject.x = x;
accelObject.y = y;
accelObject.z = z;

handleRequest(‘accel’);

return true;
}
//an object to hold acceleration values in all three dimensions.
function AccelerationObject(){
this.x = 0;
this.y = 0;
this.z = 0;
}

// the location function call made from the underlying Objective-C framework when the location of the device is determined
function GPSLocation(longitude, latitude, altitude){
window.location = “call?cmd=logMessage&msg=”+document.getElementById(‘messages’).innerText;
try{

document.getElementById(‘messages’).innerText = ‘Longitude: ‘+longitude+’ \nLatitude: ‘+latitude+’\nAltitude: ‘+altitude;
return ‘It worked!’;
}
catch(err)
{
txt=”‘There was an error on this page.\n\n”;
txt+=”Error description: ” + err.description + “‘”;
window.location = “call?cmd=logMessage&msg=”+txt;
}
return ‘It failed’;
}
//this function will scroll the current view by the x and y amount. This function is ususally called by the Objective-C portion of an application.
function customScroll(xAmount, yAmount){
//document.getElementByID(‘message’).innerHTML = xAmount+” “+yAmount+”
“;
window.scrollBy(xAmount,yAmount);
return ‘done’;
}

//remove white space from the beginning and end of a string
function trim(aString){
return aString.replace(/^\s+|\s+$/g, ”);
}

//replace all occurances of a string with another
function replaceAll(aString, replacedString, newSubString){
while(aString.indexOf(replacedString) > -1){
aString = aString.replace(replacedString, newSubString);
}
return aString;
}
//stop an event from doing its’ default behavior since it will be handled in the BCO and VCO
function stopDefault(event){
if(event){
if (event.preventDefault)// non-IE
event.preventDefault();
event.returnValue = false;// IE
}
}
/*
* These mapping functions require functions for the business rules,
* view controls, error controls, and security controls NOT the names
* of these items as strings.
*/
function mapCommandToBCF(aCmd, aBRule){
var aMappingBean = new Array();
aMappingBean[‘bcf’] = aBRule;
businessMap[aCmd] = aMappingBean;
}
function mapCommandToVCF(aCmd, aVCF){
var aMappingBean = viewMap[aCmd];
if(aMappingBean == null){
aMappingBean = new Array();
aMappingBean[‘viewFunctionArray’] = new Array();
viewMap[aCmd] = aMappingBean;
}
var funcArray = aMappingBean[‘viewFunctionArray’];
funcArray.push(aVCF);
}
function mapCommandToECF(anErrorCmd, anECF){
var aMappingBean = new Array();
aMappingBean[‘ecf’] = anECF;
errorMap[anErrorCmd] = aMappingBean;
}
function mapCommandSCF(aCmd, aSCF){
var aMappingBean = securityMap[aCmd];
if(aMappingBean == null){
aMappingBean = new Array();
aMappingBean[‘securityFunctionArray’] = new Array();
securityMap[aCmd] = aMappingBean;
}
var funcArray = aMappingBean[‘securityFunctionArray’];
funcArray.push(aSCF);
}

function mapCommandToValCF(aCmd, aValCF){
var aMappingBean = validationMap[aCmd];
if(aMappingBean == null){
aMappingBean = new Array();
aMappingBean[‘validationFunctionArray’] = new Array();
validationMap[aCmd] = aMappingBean;
}
aMappingBean[‘validationFunctionArray’].push(aValCF);
}

 

function debug(msg){
document.getElementById('debug').innerHTML = msg;
}

July 26, 2008

iPhone Coverflow

Posted in iPhone development tagged , , , , , , , at 4:01 pm by tetontech

I’v been doing some consulting this summer during the break between semesters at the university.  In this capacity I developed a version of coverflow in JavaScript for hybrid applications.  I can’t share the code or pictures of it running without violating contracts.  

I can share with you the approach.

Most of the examples you find on the web of how to do are cross platform implementations and so use way to much JavaScript for them to be functional on the iPhone.  Since hybrid iPhone apps will only be running on the iPhone we can take advantage of some of the great capabilities of WebKit.

WebKit ships as the UIWebView class for hybrid applications or as safari for web apps.  Included in the version on the phone are CSS transitions and transformations.  The great thing about these two capabilities is that they are hardware accelerated and so run incredibly faster than JavaScript implementations of the same capabilities.

So what you do is use transitions to change the size, opacity, location, etc. of the images that need to be displayed and then apply transformations to make them move.  There are many examples on the web of how to apply each of these items in other ways so it shouldn’t be to difficult to figure out how to put together a coverflow implementation on your own.

Use transitions and transformations as much as you can and minimize the amount of JavaScript.  This will make your implementation run as fast as possible.  It will not be as smooth functioning as the native implementation in iTunes but it is very functional.

Good luck and have fun.

Next page

<span>%d</span> bloggers like this: