9 Replies Latest reply on Dec 14, 2013 6:22 PM by Rob Roberts

    Problem with native tabbar in Rhodes 4.0

    Rob Roberts

      After upgrading to Rhodes 4.0 I'm having a problem with my app's native tabbar in iOS7. It isn't honoring the colors that I specify when creating it. This problem occurs only when installed on the phone. The colors are correct in the simulator. I'm using a nearly-black background, and it looks correct in the simulator but is white on the device. (I'm testing on an iPhone 4S with iOS 7.0.4.)

       

      In looking at the updated tabbar docs I see that the color parameter names are shown as selectedColor and backgroundColor, as opposed to selected_color and web_bkg_color like they used to be. I changed my parameter names to the new ones, but the colors are still not right on the device.

       

      Any ideas as to how I can fix this?

       

      Thanks in advance,

      --Rob Roberts

        • Re: Problem with native tabbar in Rhodes 4.0
          Kutir Mobility

          Hi Rob,

           

          Could you please post the code snippet that will help us to fix your problem?

           

          Visnupriya R

          Kutir Mobility

            • Re: Problem with native tabbar in Rhodes 4.0
              Rob Roberts

              Hi Visnupriya,

               

              Here is the code from my application.rb file. (This is after I changed the parameter names from web_bkg_color and selected_color to backgroundColor and selectedColor, but the behavior is identical either way. Works right in the simulator but the colors are wrong on the device.)

               

                APP_BACKGROUND_COLOR = 0x130b04

                TABBAR_ICON_COLOR = 0x98A942

               

                def initialize

                  @@toolbar = nil

                  create_tabbar

                  super

                end

               

                def create_tabbar

                  return unless System::get_property('platform') == 'APPLE'

               

                  tabs = [

                    { :label => "#{Localization::Views[:home]}", :action => "/app/Home",

                      :backgroundColor => APP_BACKGROUND_COLOR,

                      :selectedColor => TABBAR_ICON_COLOR,

                      :icon => "/public/images/bar/home_btn.png"},

                    { :label => "#{Localization::Views[:teams]}", :action => "/app/Team",

                      :backgroundColor => APP_BACKGROUND_COLOR,

                      :selectedColor => TABBAR_ICON_COLOR,

                      :icon => "/public/images/bar/icon_users.png" },

                    { :label => "#{Localization::Views[:players]}", :action => "/app/Player",

                      :backgroundColor => APP_BACKGROUND_COLOR,

                      :selectedColor => TABBAR_ICON_COLOR,

                      :icon => "/public/images/bar/icon_user.png" },

                    { :label => "#{Localization::Views[:games]}", :action => "/app/Game",

                      :backgroundColor => APP_BACKGROUND_COLOR,

                      :selectedColor => TABBAR_ICON_COLOR,

                      :icon => "/public/images/bar/icon_users.png" },

                    { :label => "#{Localization::Views[:settings_abbrev]}", :action => "/app/Settings",

                      :backgroundColor => APP_BACKGROUND_COLOR,

                      :selectedColor => TABBAR_ICON_COLOR,

                      :icon => "/public/images/bar/gears.png" }

                  ]

                  Rho::NativeTabbar.create(:tabs => tabs)

                end

               

              --Rob Roberts

            • Re: Problem with native tabbar in Rhodes 4.0
              Robert Galvin

              iOS7 now has a few new options : http://docs.rhomobile.com/guide/build_ios#differences-building-for-ios7

               

              So you will need to use

               

              { :label => "#{Localization::Views[:home]}", :action => "/app/Home",

                      :backgroundColor => APP_BACKGROUND_COLOR,

                      :iOS7SelectedColor => TABBAR_ICON_COLOR,

                      :icon => "/public/images/bar/home_btn.png"},

                • Re: Problem with native tabbar in Rhodes 4.0
                  Rob Roberts

                  Thanks Robert. I tried that, but it's still not working for me. And it's not just the selected color that is wrong on the device. The background color is wrong too. It's kind of off-white when it should almost black.

                   

                  I think I've got some configuration problem with the app since upgrading to Rhodes 4.0, though. (That could be what's causing this issue.) It seems like it's building for 6.1 instead of 7.0. When using rake run:iphone to build for the simulator I see that rhodes creates directories in Library/Application Support/iPhone Simulator/7.0 and copies files there. But it also creates Library/Application Support/iPhone Simulator/6.1, and that's the one it uses for the database files, rholog.txt, etc.

                   

                  --Rob Roberts

                    • Re: Problem with native tabbar in Rhodes 4.0
                      Rob Roberts

                      I did finally get the app built for and running in the iOS7 simulator. I had to build it with Xcode to get it to work. Using rake run:iphone always ends up building it for iOS6,1, even though my build.yml file has "sdk: iphonesimulator7.0". But now that it's running in the iOS7 simulator it has the same problem as on the device: the native tabbar ignores the background and selected icon colors that I've specified when creating it, and instead uses white for the background color and light blue for the selected icon color. (I did change it to use iOS7Selected color instead of selectedColor, but it didn't make any difference.)

                       

                      --Rob Roberts

                  • Re: Problem with native tabbar in Rhodes 4.0
                    Robert Galvin

                    Can you do a gem list and display what version of the rhodes gems are installed. Also can you share what your build.yml looks like?

                      • Re: Problem with native tabbar in Rhodes 4.0
                        Rob Roberts

                        Sure, here are the rhodes-related gems that gem list shows:

                         

                        rhoconnect (4.0.1, 4.0.0)

                        rhoconnect-adapters (1.0.6)

                        rhoconnect-client (4.0.0)

                        rhodes (4.0.0, 3.5.1.12, 3.3.3)

                        rhodes-translator (0.0.4)

                        rhoelements (4.0.0)

                        rhohub (1.0)

                        rhomobile-debug (1.0.7)

                         

                        Here is my build.yml:

                         

                        ---

                        extensions:

                        - fileutils

                        - rholang

                        - json

                        - mspec

                        capabilities:

                        - pim

                        name: Test App

                        bbver: 4.6

                        build: debug

                        #build: production

                        applog: rholog.txt

                        wmsdk: Windows Mobile 6 Professional SDK (ARMV4I)

                        version: 0.4.42

                        vendor: rhomobile

                        sdkversion: 4.0.0

                        iphone:

                          provisionprofile: <...>

                          sdk: iphonesimulator7.0

                        #  sdk: iphoneos7.0

                          entitlements:

                          codesignidentity: ! 'iPhone Developer: <...>'

                          iphone_use_new_ios7_status_bar_style: 1

                          configuration: Debug

                        #  configuration: Release

                        #sdk: /Users/rob/.rvm/gems/ruby-1.9.3-p484/gems/rhodes-4.0.0

                         

                        Thanks,

                        --Rob Roberts