Results 1 to 3 of 3

Thread: Sencha Touch App in UIWebView - wrong dimensions on 'orientationchange' event

  1. #1
    Touch Premium Member
    Join Date
    Dec 2010
    Location
    Bonn, Germany
    Posts
    18

    Question Sencha Touch App in UIWebView - wrong dimensions on 'orientationchange' event

    Hi,

    I'm developing a Sencha application to be displayed in a UIWebView inside of an iPhone application. I found an issue with orientation changes. First, I had to manually trigger the Sencha 'orientationchange' event on the UIWebView when it's orientation changed, as indicated in this thread:

    http://www.sencha.com/forum/showthre...s-by-uiwebview

    Now I'm using JSConsole (http://jsconsole.com/) to log orientation changes. I found out, that the 'orientationchange' is now indeed fired, but the dimensions are wrong. Example: starting in Portrait, the UIWebView dimensions as well as the reported main view dimensions are 768 x 1004. However, if I rotate to landscape, the UIWebView is now 1024 x 748, but the main sencha view's dimensions are reported as 1024 x 1004.

    The application is constructed as follows: we're using the Application class, which dispatches a ViewController providing the main view. The main view is configured like this:

    Code:
    /** This is the application's main panel.
     * @base Ext.Panel
     */
    ui.MainView = Ext.extend(Ext.Panel,
    {
    	id: 'ui-main',
    
            layout: 'fit',
    
    	fullscreen: true,
    
    	layoutOnOrientationChange: true,
    
            monitorOrientation: true,
    
    	style: 'backgroundColor:white',
    
            initComponent: function()
    	{
                 ui.MainView.superclass.initComponent.apply(this, arguments);
            },   
    	listeners : 
    	{	
    		orientationchange : function( element, orientation, width, height ) 
    		{
    			console.log("MainView:orientationchange: orientation = "+orientation+" w="+width+",h="+height);
    		}
    	}
    });
    
    /** Application main panel xtype registration
     */
    Ext.reg('ui-mainview', ui.MainView);
    which seems straightforward enough. So why is the height not updated properly on 'orientationchange' ? Am I overlooking something?

  2. #2
    Touch Premium Member
    Join Date
    Nov 2008
    Posts
    3

    Default Same here...

    We are experiencing the same issue. If I find something I'll respond.
    I'm assuming that nobody else has any immediate ideas.

  3. #3
    Touch Premium Member
    Join Date
    Nov 2008
    Posts
    3

    Default

    Here is what is causing the issue.

    Within Ext.Viewport.getSize() there is the following:

    if (!Ext.is.Desktop) {
    size.height = (this.orientation == this.initialOrientation) ?
    Math.max(this.initialHeight, size.height) :
    size.height
    }

    By validating that it isn't iOS also, then it will fix the UIWebView. Once I get some more testing around Android, etc., I'll post to determine if there is a greater change that I'd like to suggest.

    if (!Ext.is.iOS && !Ext.is.Desktop) {
    size.height = (this.orientation == this.initialOrientation) ?
    Math.max(this.initialHeight, size.height) :
    size.height
    }

Similar Threads

  1. Replies: 16
    Last Post: 5 Aug 2011, 4:58 AM
  2. Sencha in UIWebView?
    By bessfernandez in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 29 Oct 2010, 12:58 AM
  3. JsonStore public event load in Sencha Touch?
    By cabennett85 in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 5 Aug 2010, 4:53 PM
  4. Create a Sencha project in Apple UIWebView
    By Smalldevil in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 24 Jun 2010, 4:02 AM
  5. Messagebox - Wrong Box dimensions
    By fman in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 18 Dec 2007, 8:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •