May 27, 2009
QuickConnectiPhone download now made smaller
I have reposted the QuickConnectiPhone Beta 8 installer on sourceForge. I was able to reduce the size of the movies included in the Mac example dramatically and now the download is a reasonable size.
By the way, the Mac port will now play and loop any movie of any type your QuickTime player will handle.
May 26, 2009
QuickConnectiPhone 1.5 Beta 8 is now available!
I have merged the installers for QCiPhone, QCMac, and QCPHP. They are now part of the QCiPhone download from sourceForge.
You can now make a Bonjour service on your Mac and connect to it from your iPhone or iPod touch or switch it around and publish the service on your iPhone or iPod touch and connect to it from your Mac.
The download is larger due to the videos included in the Mac Device Catalog example. I’ll try to pare this down for the final release.
The Mac port has begun to catchup with the iPhone version.
After 1.5 ships I’ll start shipping more of the OS 3.0 functionallity as 1.5.x betas.
The changes for this beta include:
iPhone 1.5 beta 8:
- Fixed stateSaving Example
- Simplified and fixed the asynchronous call handling code so that multiple asynchronous calls can be made in any order and intermingled with synchronous calls.
- Created an example of using native footers.
- Added an image display to show the default.png file if one exists to ‘hide’ the web view as it loads the JavaScript, CSS, and HTML files.
- Added a function to allow you to programatically turn copy-paste on and off.
- I still need to create an example of and the code for native headers and navigation bars.
Mac 1.0 beta 2:
- Simplified and fixed the asynchronous call handling code so that multiple asynchronous calls can be made in any order and intermingled with synchronous calls.
- Added recording and playing of audio.
- Added recording and playing of video.
- Added Shipped audio and video playing.
- Added Looping of audio and video.
- Added Bonjour networking (Client and Server)
- Added Error Logging and debug messages
- Fixed database interaction for both native and in browser databases
May 1, 2009
Scrolling individual elements in hybrid or web applications
A request has been made to show how individual elements in a hybrid or web application can be scrolled on the iPhone. I have included some code below that has all of the JavaScript requried to accomplish this. It comes from the QCUtilities.js file of QuickConnect iPhone 1.5 release that will be posted within a couple of days.
Because it is from QuickConnect it includes the ability to add request handling for when the user touches the screen in preparation for scrolling, as well as each time the finger is moved and when the scroll action is complete. If you want to use this code outside of QuickConnect then remove everything regarding the startDragCmd, dragCmd, and dropCmd parameters.
If you want to use this within an older version of QuickConnectiPhone place the code in your version of the QCUtilities.js file and it works.
This approach uses the CSS transitions, proposed for HTML 5, available in WebKit instead of the standard JavaScript approach since that approach is much to slow for both the iPhone and iPod touch devices.
To make an element scrollable call the makeScrollable function and pass the element you want to be scrollable as the first parameter. If you want the element to not be scrollable below its original y axis location pass true as the second parameter of makeScrollable. Here is the onload event code from the scrollingElements example of the upcoming QuickConnectiPhone 1.5 release that sets three views in a view stack to be scrollable.
Making elements scrollable
function load()
{
dashcode.setupParts();
makeScrollable(document.getElementById(‘view1’));
makeScrollable(document.getElementById(‘view2’));
makeScrollable(document.getElementById(‘view3’));
}
Scrolling Functions to Add
/*
* Pass any DOM element to this function to make it scroll
* The *Cmd parameters are optional commands to be handled for
* scroll events.
*/
function makeScrollable(anElement, scrollBothUpAndDown, startDragCmd, dragCmd, dropCmd){
anElement.ontouchstart = prepareScroll;
anElement.ontouchmove = scrollIt;
anElement.ontouchend = scrollDone;
anElement.scrollBothUpAndDown = scrollBothUpAndDown;
//do not set or reset the commands if none are passed in.
if(startDragCmd){
anElement.startDragCmd = startDragCmd;
}
if(dragCmd){
anElement.dragCmd = dragCmd;
}
if(dropCmd){
anElement.dropCmd = dropCmd;
}
}
/*
* This function is triggered each time an ontouchmove event is
* fired for an element that has been passed to makeDraggable.
*/
function scrollIt(event)
{
stopDefault(event);
this.y = event.targetTouches[0].clientY – this.offsetY;
if(this.lastY){
this.y += this.lastY;
}
if(this.scrollBothUpAndDown || this.y < 0){
this.style.webkitTransform = ‘translate(0px, ‘ + this.y + ‘px)’;
}
else if(this.y >= 0){
this.style.webkitTransform = ‘translate(0px, 0px)’;
}
if(this.dragCmd){
var params = new Array();
params.push(event);
params.push(this);
handleRequest(this.dragCmd, params);
}
}
/*
* This function is triggered every time an ontouchstart event is
* fired for an element that has been passed to makeDraggable.
*/
function prepareScroll(event)
{
stopDefault(event);
//store off any timing and duration set anywhere else in the app
//and turn them off so they don’t interfere with the scrolling
this.timing = this.style.webkitTransitionTimingFunction;
this.style.webkitTransitionTimingFunction = null;
this.duration = this.style.webkitTransitionDuration;
this.style.webkitTransitionDuration = null;
this.touches = event.targetTouches;
this.offsetY = event.targetTouches[0].clientY;
if(this.startDragCmd){
var params = new Array();
params.push(event);
params.push(this);
handleRequest(this.startDragCmd, params);
}
}
/*
* This function is triggered every time an ontouchend event is
* fired for an element that has been passed to makeDraggable.
*/
function scrollDone(event)
{
//this.ontouchmove = null;
//this.ontouchend = null;
if(this.scrollBothUpAndDown || this.y < 0){
this.lastY = this.y;
}
else{
this.lastY = 0;
}
//restore any timing or duration that was set anywhere else in the app
this.style.webkitTransitionTimingFunction = this.timing;
this.style.webkitTransitionDuration = this.duration;
if(this.dropCmd){
var params = new Array();
params.push(event);
params.push(this);
handleRequest(this.dropCmd, params);
}
}