viezel / NappSlideMenu

a new UI component for Appcelerator Titanium
Other
128 stars 34 forks source link

iOS 7 statusBarStyle #22

Closed arskinner closed 10 years ago

arskinner commented 11 years ago

I just tried running one of our apps on iOS 7 and it seems that setting the statusBarStyle on the SlideMenu window doesn't work. No matter what the status bar text is black, which doesn't work over a dark background. Any idea how to get the status bar color set properly? Would it help to recompile the module from source?

viezel commented 11 years ago

You can try to recompile it with 3.1.3. I'm not setting the status bar anywhere, so I might be some default behavior.

beaur commented 11 years ago

I tried recompiling with 3.1.3 and didn't have any luck...

viezel commented 11 years ago

what about this?

<ios>
    <plist>
        <dict>
            <key>UIStatusBarStyle</key>  
            <string>UIStatusBarStyleLightContent</string>
        </dict>
    </plist>
</ios>
arskinner commented 11 years ago

That was the first thing I tried. It definitely changes every other window to the light mode, but the SlideMenu windows remain dark.

viezel commented 11 years ago

hmm. then I guess it is the library. The bad news is that the guy who made it, is not updating it anymore..

arskinner commented 11 years ago

@beaurushton did you recompile the SlideMenu module or did you just recompile your app on 3.1.3? I haven't tried rebuilding the module from source yet.

beaur commented 11 years ago

I recompiled the module. Had to change one line of code in DkNappSlidemenuSlideMenuWindow.m Line 28 return [[[TiViewController alloc] initWithViewProxy:(TiViewProxy*)proxy] autorelease]; return [[[TiViewController alloc] initWithViewProxy:proxy] autorelease]; as someone suggested in your NappDrawer module...

beaur commented 11 years ago

I've managed to work around this by adding the code @viezel mentioned about the the tiapp.xml and then explicitly setting the center window again after opening it. eg.

var window = NappSlideMenu.createSlideMenuWindow({
    centerWindow: alerts,
    leftWindow:winLeft,
    translucent: false,
    leftLedge: 100,
});
window.open(); //init the app
window.setCenterWindow(alerts); // hack to reset statusbar to light content
viezel commented 11 years ago

interesting @beaurushton. Does that also work for you @arskinner ?

mantonaci commented 11 years ago

Thanks @beaurushton , it work fine for me. Another work around is to open slide menu like modal window with this solution you don't need to set the center window again after opening it.

var window = NappSlideMenu.createSlideMenuWindow({
    centerWindow: alerts,
    leftWindow:winLeft,
    translucent: false,
    leftLedge: 100,
    modal: true
});

window.open(); //init the app
mantonaci commented 11 years ago

But this is a strange behavior, what do you think @viezel?

viezel commented 11 years ago

it is. Its because the window architecture changed in Titanium to support iOS7. So until I figure out a new way to support this, I guess the hacks are the only way. NOt great, but it works.

mantonaci commented 11 years ago

Great, however @beaurushton if the center window is a NavGroup and you set it again the center window show a black window as described in #18.

arskinner commented 11 years ago

Yes, the modal: true solution works for me. I did definitely have to rebuild with 3.1.3.GA to get modal: true to work though, it did not work with the module in the dist folder.

jkritikos commented 11 years ago

I've tried to follow your advice on this issue but I can't get it to work..I would really appreciate it if someone could mention all the required steps in a single post :) By the way, regarding the changes mentioned for tiapp.xml do we just paste:

UIStatusBarStyle UIStatusBarStyleLightContent

I am already using a custom plist file for custom fonts, so perhaps I need to include the above mentioned key/value pairs directly in my plist file instead of tiapp.xml?

Many thanks to everyone looking into the issue.

jkritikos commented 11 years ago

Cancel that, it works ok by modifying tiapp.xml and using modal:true. However, I cannot set the status bar color to be the same as my nav bar color (as seen on manu ios7 apps) - has anyone been able to do so?

viezel commented 11 years ago

have a try with this new release: https://github.com/viezel/NappSlideMenu/releases/tag/1.4.0

iskugor commented 11 years ago

Hi.

I managed to solve this issue by using "modal: true", but then every new window has to be modal too - and then they are animated from the bottom (which is not that you want to have for all windows, looks really badly).

Is there any other workaround?

I'm using latest version of this module.

Thanks,

Ivan

iskugor commented 11 years ago

And funny thing is ... after I open new window for second time (with correct status bar color), it somehow fixes status bar color of this module's window (so, first time I open and close new window, color is black, after second time, it's white)!

Weird ...

iskugor commented 11 years ago

Hahaha ... well, I found a workaround, can't believe how dumb it is, I didn't think it would work, but it tried it and it worked.

After you open module's window, do this:

var tmpWin = Ti.UI.createWindow({
    backgroundColor: 'transparent',
    zIndex: 1000,
    touchEnabled: false
});

tmpWin.open();
tujoworker commented 10 years ago

This works as well:

var dummyWin = Ti.UI.createWindow({ width:0, height:0, statusBarStyle: Ti.UI.iPhone.StatusBar.LIGHT_CONTENT, // fullscreen: true, }); dummyWin.open();

Remember to read this: http://docs.appcelerator.com/titanium/latest/#!/guide/iOS_7_Migration_Guide-section-37533766_iOS7MigrationGuide-StatusBar

viezel commented 10 years ago

Fixed: https://github.com/viezel/NappSlideMenu/releases/tag/1.4.2

jerodfritz commented 10 years ago

Hey Mads, Awesome module. I tested and this latest fix allows you to set the Status Bar style but I'm still needing the tmpWin.open() hack to hide the statusbar. Any suggestions how to do this more cleanly?

viezel commented 10 years ago

cant you just set that in the tiapp.xml file?

tujoworker commented 10 years ago

For me it works now without the dummyWindow hack. Just set the statusBarStyle in the leftWindow.

var leftWindow = Ti.UI.createWindow({
    statusBarStyle: Ti.UI.iPhone.StatusBar.LIGHT_CONTENT,
    ...
});

Or use the default solution: https://github.com/viezel/NappSlideMenu#statusbarstyle