I don't want the phone to go to sleep so I am using:
[ [ UIApplication sharedApplication ] setIdleTimerDisabled:YES ] ;
but I do need the phone to gray out its screen to not waste the battery. I have already seen this question How can I dim the view in an iPhone application?, but need more detail please.
I am trying something like this:
to set the opaqueWindow as frontmost (which has a 320 x 480 black image loaded)
[opaqueWindow makeKeyAndVisible];
[ opaqueWindow setAlpha:1.00 ] ;
[ mainWindow setAlpha:0.10 ] ;
and to try to go back to the mainWindow and set it frontmost (a picker control and some labels):
[ opaqueWindow setAlpha:0 ] ;
[mainWindow makeKeyAndVisible];
[ mainWindow setAlpha:1.00 ] ;
There can only be one key window in my app, right? so when mainWindow becomes key, then opaqueWindow isn't and vice versa. I create opaqueWindow and access mainWindow as follows:
opaqueWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen ] bounds]];
opaqueView = [[UIView alloc] init];
[opaqueWindow addSubview:opaqueView];
mainWindow = [ myApplication keyWindow ] ;
Even when I try to make my mainWindow active again, my controls are still grayed out and opaqueWindow still seems to have control.
I am a newbie at iphone development, I have been looking at the Cocoa Touch for iphone 3 developer reference and a few other books.
I would appreciate any help or advice.
thank you!
Piesia
Edit: I'm assuming that opaqueWindow will need to pass down button clicks to mainWindow while opaqueWindow is key. Do I just call mainWindow's button handler from within opaqueWindow's button handler or is there a better way to do it. thanks! P.