How to keep the iOS7 statusbar from beeing drawn over the titlearea in iOS6 mode theme?

38 views
Skip to first unread message

Michael Kroll

unread,
Aug 11, 2014, 5:57:26 PM8/11/14
to codenameone...@googlegroups.com
Hi!

I'm using a heavily customized theme, derived from the iOS6 theme and thus am using the forced iOS6 theme mode to save me some work.
My problem is, that the gap above the title area doesn't get created, so the statusbar gets drawn over screen content.

I know there is a StatusBar style in the iOS7 theme and I tried to create one in my theme but it doesn't seem to have any effect.
Is there a way of solving this without using the automatic/iOS7 theme mode?

I could check in code if iOS7 is used and add some padding to the title area if so, but I would really like to do it the right way.

Shai Almog

unread,
Aug 12, 2014, 12:32:30 AM8/12/14
to codenameone...@googlegroups.com
Hi,
this only takes effect if you define the theme constant paintsTitleBarBool=true so once you add that to your theme it should work.

Michael Kroll

unread,
Aug 12, 2014, 5:09:09 AM8/12/14
to codenameone...@googlegroups.com
I still had to do some things in code for it to work right.
Just adding the constant to the theme caused it to be rendered even on iOS6 so I did this:


        Hashtable specialThemeProps = new Hashtable();
        
        if(Display.getInstance().getPlatformName().equals("ios")){
            String os_version = Display.getInstance().getProperty("OSVer", "0");
            int os_ver = 0;
            try{
                
                StringTokenizer token = new StringTokenizer(os_version, ".");
                os_ver = Integer.parseInt(token.nextToken());
                Log.p("Running iOS " + os_ver);
            }catch(NumberFormatException ex){
                Log.p("Could not parse OS Version");
            }
            
            if(os_ver >= 7){
                specialThemeProps.put("@paintsTitleBarBool", "true");
            }
        }
        
        UIManager.getInstance().addThemeProps(specialThemeProps);

Seems to work.

Reply all
Reply to author
Forward
0 new messages