1. #1
    Sencha User
    Join Date
    Apr 2007
    Posts
    11
    Vote Rating
    0
    yuryb is on a distinguished road

      0  

    Default onOrientationChange event is not being handled properly on ip* devices by uiwebview

    onOrientationChange event is not being handled properly on ip* devices by uiwebview


    you're probably aware of this problem, but:
    onOrientationChange event is not being properly handled by the iPhone sdk's component UIWebView, which is basically a built-in "safari" browser and is being used in all ip* apps where the browser functionality is needed.
    due to this problem, none of the sencha touch demos are working properly if opened in any other browser than the native safari on ip*s: programmatic ui changes which has to happen on orientation change are not happening.
    to see the problem, run kitchen sink in any 3-rd party browsers you can get from the apple's app store (atomic web, mercury, ilunascape, ifindz to name a few). the problem is especially severe on ipad.
    do you have any suggestions what can be done to fix/work around this problem?
    i'm ready to publish an app written in sencha (great great framework, btw, thank you!), and that is the only reason for the delay.
    any help would be greatly appreciated.
    thank you in advance,
    yury

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    So why do you say this is a bug in Touch? If the browser doesn't support the orientationchange event like it should, there isn't really much we can do about it.

    As a side note, it doesn't seem to support local urls (http://10.0.0.2), what a waste of a dollar!
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Apr 2007
    Posts
    11
    Vote Rating
    0
    yuryb is on a distinguished road

      0  

    Default


    here is why i said it is still a sencha problem:
    -- i've put some js function call into my iOS code to call the page loaded into uiwebview when device orientation changes;
    -- in this call i was trying to call sencha's layout routines: doLayout(), etc;
    -- ui goes crazy in this case, due to the fact that some internal values in the sencha's layout engine are off and in dis-array; for instance Ext.orientation returns 'portret' in landscape, but screen dimensions look like landscape's;
    -- i tried to follow some suggestions on this board and go through a "window resize" rout. it produced sporadic success/failure results on kitchen sink: sometimes ui re-renders properly, and some times - some elements are off-screen and/or have wrong sizes.

    please do not be offensive, i truly love your product!
    i just need some sort of suggestion from people who knows how the stuff works inside :-))

    as of now, the only stable (but soooooo ugly) solution is to call 'document.location = document.location' on each orientation change, which works fine, just... not cool at all :-((

    please help if you can.
    thanks again.

    (btw, i've purchased sencha-touch license a couple of days ago)

  4. #4
    Sencha User
    Join Date
    Apr 2007
    Posts
    11
    Vote Rating
    0
    yuryb is on a distinguished road

      0  

    Default


    please respond - i need to know what can be done!
    thank you...

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Again, back to the original point, why doesn't the browser fire the orientationchange event? We can only react to the events made available. Have you talked with the developers of the browser?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Ext User
    Join Date
    Dec 2007
    Posts
    4
    Vote Rating
    0
    iame.wang is on a distinguished road

      0  

    Default


    when orientation changed:

    UIWebView.stringByEvaluatingJavaScriptFromString("var e = document.createEvent('Events'); e.initEvent('orientationchange', true, false); document.dispatchEvent(e); ");

    sencha touch will work

  7. #7
    Sencha User
    Join Date
    Apr 2007
    Posts
    11
    Vote Rating
    0
    yuryb is on a distinguished road

      0  

    Default


    thank you very much!
    your solution resolved the problem!

  8. #8
    Ext User
    Join Date
    Aug 2010
    Posts
    3
    Vote Rating
    0
    lieselbr is on a distinguished road

      0  

    Default


    Quote Originally Posted by iame.wang View Post
    when orientation changed:

    UIWebView.stringByEvaluatingJavaScriptFromString("var e = document.createEvent('Events'); e.initEvent('orientationchange', true, false); document.dispatchEvent(e); ");

    sencha touch will work
    Hi, this line of code i have to use it inside xcode?

  9. #9
    Sencha User
    Join Date
    Aug 2010
    Posts
    17
    Vote Rating
    0
    milo08 is on a distinguished road

      0  

    Default


    Hi lieselbr,

    yes you have to do this in the ViewController from your UIWebView, in the didRotateFromInterfaceOrientation function.

    Code:
    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
    {
            [yourWebview stringByEvaluatingJavaScriptFromString:@"var e = document.createEvent('Events'); e.initEvent('orientationchange', true, false); document.dispatchEvent(e); "];    
    }
    that works, but in my tests is very slow. I don`t know its my app, i will test it.

    greetz

    milo

  10. #10
    Ext User
    Join Date
    Aug 2010
    Posts
    3
    Vote Rating
    0
    lieselbr is on a distinguished road

      0  

    Default works

    works


    Thanks man work just fine for me

Similar Threads

  1. Sencha in UIWebView?
    By bessfernandez in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 29 Oct 2010, 12:58 AM
  2. Do nothing onOrientationchange.
    By gabrielstuff in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 7 Sep 2010, 4:04 PM
  3. changing scroll direction onOrientationChange
    By cabennett85 in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 3 Aug 2010, 1:17 PM
  4. Replies: 4
    Last Post: 9 Dec 2009, 7:46 AM

Thread Participants: 9

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi