January 18, 2009

QuickConnectiPhone 1.1.2 now available

Posted in Uncategorized tagged , , , , , , , , at 3:47 am by tetontech

In response to a request from a developer using QCiPhone version 1.1.2 has been created.  It includes the ability to retrieve the device unique id, name, type, OS and OS version from JavaScript.

An example application is included.

Advertisements

25 Comments »

  1. cjr said,

    Hello, The nativeDBAccess sample is not working ?

    thanks

    • tetontech said,

      It looks like I had an old version of the project in the Examples. I have updated it. Please download and try again.
      Thank you for the heads-up.

  2. sam said,

    I’m having a problem with UIScrollView. I’m using the quickconnect template, and I’m not sure how to turn off scrolling (or bouncing?). Could you please help?

    Thank you very much for the incredible framework.

    • tetontech said,

      I assume you are adding this UIScrollView yourself since it is not part of QuickConnect. Why, may I ask, are you using a UIScrollView if you don’t want it to scroll? Why not use a UIView instead?

  3. Sam said,

    Was my previous comment deleted?

    • tetontech said,

      It wasn’t deleted. I just hadn’t had time to go over the comments yet.

  4. Sam said,

    I’m sorry that’s not what I meant. I didn’t add a UIScrollView.

    I’m very new to objective c. A UIView would probably be better, but how do I disable scrolling this way?

    Additionally, I noticed there’s a lag when opening the app, as if the HTML page is loading (white screen). Is there any way to prevent this?

    • tetontech said,

      Sam,

      If I understand your question you are saying that the UIWebView is scrollable and you do not want it to be. Is this the case?

      The framework doesn’t include a splash screen, you would need to include that yourself. It is pretty easy. You can find how to do this here. Assuming that your html file and JS files aren’t huge there should not be much of a lag time between the display of the UIWebView and the showing of the page since the page load is begun prior to the display of the UIWebView in the framework.

  5. Sam said,

    Thanks for the response.
    The UIWebView is scrollable, and I want it to be scrollable but I don’t want it to bounce (i.e. I don’t want to have the ability to drag it down enough or high enough to be able to see the gray background).

    I’ve been using the Default.png but what happens is this: the PNG is displayed, the screen goes white for a few seconds (as if the HTML page is loading), and finally the page is displayed.

    So I’m assuming the Default.png is being told to go away once the actual application has finished loading, even though the actual HTML page has not. The HTML, JS, and CSS files come to a total of about 30 KB.

    Thanks again.
    -Sam

    • tetontech said,

      If you look in the MapView of QCiPhone there is an example of how to do this. It is not simple. In essence you turn off user interaction with the UIWebView and put it inside a UIView. This means that the UIWebView will not respond to any touches. The containing UIView will then recieve all of the touches. You will need to implement the touchesBegan, touchesMoved, and touchesEnded methods.

      It does take a little bit of time to load the web content. Maybe that is what you are seeing.

  6. Sam said,

    Thank you, I’ll try that.

    Is there a way to have the Default.png stay up until the web content loads?

    • tetontech said,

      The Default.png shows only until the application is launched not until all of the views are active. The option here would be to have a view that displayed the Default.png imidiatly when the application became fully active and remove it when the page is fully loaded. This way it would look like the splash screen was still there. I’ll add this functionality to the framework in an early version of the 1.5 beta.

  7. Sam said,

    Great thank you.

  8. Aarpn said,

    tetontech — The question Sam has asked is EXACTLY what i was just about to ask! 🙂

    QuickConnect is great! I’ve been able to do so much quickly because i know JS, but not object C.

    I really want to be able to turn off the bounce of the UIWebView. If the content all fits in a single screen, the user is still able to pull down the “UIWebView” and make it bounce so you can see the grey behind it.

    Looking at your comment on how to turn off the interaction:

    “…In essence you turn off user interaction with the UIWebView and put it inside a UIView. This means that the UIWebView will not respond to any touches. The containing UIView will then recieve all of the touches. You will need to implement the touchesBegan, touchesMoved, and touchesEnded methods…”

    are the “touchesBegan, etc” methods used within javascript, like:

    document.getElementById(“button”).ontouchstart = function(evt){
    moveup()
    }

    Or would they need to be created in the object C application?

    Sorry if these questions sound stupid, but I’m totally new to iphone dev, and really just want to be able to make my JavaScript games inside a fixed size/non-bouncing UIWebView.

    (I’d be willing to pay for a demo/source of what I’m trying to achieve.)

    Cheers.

  9. Sam said,

    Same here. A demo would be great. Willing to pay as well

    • tetontech said,

      Money isn’t the object. I am willing to create an example for free. It is a matter of time. I could maybe give you one that would handle single touches to select html elements. It would not cover gestures.

  10. Sam said,

    Would scrolling still work in such an example?

    To clarify, I think Aarpn’s and my goal are different:
    – I still want scrolling, just without the excess gray areas on the top and bottom when scrolling too high or too low
    – I believe Aarpn’s wants no scrolling, if I’m correct.

    Again, this is an incredible framework you’ve created. Do you accept donations?

    • tetontech said,

      I could modify the map code from the framework as an example. Then it would have scrolling and respond to touches. I don’t accept donations. I am doing this to be helpful. Thanks for the offer though. If you want to help, do what you can to spread the word about the framework.

      I’ll see what I can do over the next few days if that is fast enough for you guys.

  11. Aarpn said,

    Hi again,

    I would really like the UIView to scroll — but not when all the content fits on a single screen.

    So if i have a page exactly the dimensions the iphone screen can handle – i would like it so the user could not “bounce” the screen up and down.

    When the html page is longer then the iphone screen, i would like it that the UIView can scroll — and wouldnt mind the bouncing at the bottom then.

    I’m sure the configuring of the UIView is nothing to do with your amazing QuickConnectiPhone tetontech! So thanks for all the help you are offering. 🙂

    I’d love to see an exmaple, and i will be telling everyone about QuickConnect!

    • tetontech said,

      OK. I can make this work but before I create an example I want to explain how it will work and what the impact will be because this is not something simple to pull off. Nor is it free with respect to computational time on the device.

      Impacts:
      1. Not all gestures will work. Only scroll and touch. Examples of some of the gestures that won’t work are swipes to change views, drag and drop, rotational gestures, and the upcoming copy/paste, as well as anything other than scroll and touch.
      2. No gestures or touches can be interpreted in the JavaScript.
      3. Additional prep-time will be needed each time the application starts. The amount of time required is directly proportional to the number of DOM nodes in the HTML page. More complex applications will take longer.
      4. Touches may appear slow to the user depending on how many nodes have their onclick listener set. The amount of time required to respond to a touch is directly proportional to the number of clickable nodes in the HTML page. More complex applications will take longer.

      Here are the computational steps at application start.

      1. In JavaScript walk the DOM at onload and find all of the nodes with an onclick listener set.
      2. Store each clickable DOM node found in a JavaScript array.
      3. Store the array index, and the top, left, bottom, right screen values of the clickable DOM node in an in-browser db
      4. Turn off ALL user input to the UIWebView

      Here are the computational steps when the user taps the screen
      1. Trap the event in Objective-C
      2. From Objective-C call a JavaScript function and pass it the x and y values of the touch and the touch count(single, double click, etc.)
      3. In JavaScript query the database somewhat like this: SELECT index FROM clickable WHERE top <=? and left <=? and right >= ? and bottom >= ?. Use the x and y values passed for the ? place holders
      4. Use the index retrieved to get the node from the array created in the previous computational list
      5. Generate a click method and pass it to the node for processing.

      For scrolling the code is nearly the same as in the MapView so I don’t need to go over it here. In fact, it is a little smaller since it doesn’t involve latitudes and longitudes.

      Please evaluate how badly you need to turn off the bounce and tell me if you still would like me to proceed with an example of all the code to pull this off?

  12. Aarpn said,

    tetontech – thanks so much for the info!

    I have found a way to turn off the bounce by just using javascript, and the code is here to share for everyone to try:

    addEventListener(“load”, function() { setTimeout(hideURLbar, 0); }, false);

    function hideURLbar(){
    window.scrollTo(0,1);
    document.ontouchmove = function(e){ e.preventDefault(); }
    }

    This works perfect for me, and completly stops the bouncing of the UIView.

    Thanks again for QuickConnectiPhone!!! 🙂

    • tetontech said,

      This would certainly turn off the bounce. It also turns off all scrolling.

      Sam, the addEventListener line of code is not required if you put a call to hidURLbar in a function that is assigned to the onload listener of the body. The framework has a method called load that is such a function. Also, since there is no URLbar in a UIWebView the scrollTo method call is not needed. The code below will is all that is needed. Remember, this methodology stops ALL scrolling and if I understand your comments you want to still be able to scroll your content.

      function load(){
      document.ontouchmove = function(e){ e.preventDefault(); }
      }

      I have played with this approach a little bit to see if I could find a set of if statements that would make the bounce disapear but still let you scroll the screen. So far it is buggy and almost works.

  13. sam said,

    Where do place the addEventListener?

  14. sam said,

    tetontech–
    You’re right, I still do want to be able to scroll my content.

  15. Aarpn said,

    Sam, can you not just use the function, then check the page height, and only set the preventDefault if its the height of a single screen?

    function load(){
    var pheight = document.body.scrollHeight;
    if(pheight > 480){
    document.ontouchmove = function(e){ e.preventDefault(); }
    }
    }

    This will stop scrolling and bouncing when the page fits exactly on a single screen. But when the page is longer then the screen, will allow the scrolling (and the bounce 😦

    Otherwise i guess the only way to do it is the long method explained by tetontech.

    P.s — im ok with the bounce when the screen is long — so im happy now! 🙂

    Cheers.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: