Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

benceb

macrumors newbie
Original poster
Sep 22, 2008
4
0
Hi People,

Do anybody know how to get touch events on the status pane area? My code sets sp to hidden, in IB both the window and view are full sized, and in the code I get the whole screen for both the "frame" and "bounds", but touchesBegan() not called if I click/press on the sp area. Any idea or hint?

Thanks:
Bence


code:
[application setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:NO];
[application setStatusBarHidden:YES animated:NO];
CGRect rect = [window bounds];
CGRect frame = [window frame];
CGPoint cent = [window center];
 
Firstly, why are you setting the status bar style before you hide it? pointless.

The rect you are using isn't the full screen try:-

Code:
CGRect fullscreenRect = [UIHardware fullScreenApplicationContentRect];
 
Thanks for the fast reply,

Yes UR right... the first line is absolutely useless. Thanks I'll remove.
Now I'm hacked UIHardware.h to my app (because it leaks from the official iPhone SDK).

CGRect fullscreenRect = [UIHardware fullScreenApplicationContentRect];
says [0,20,320,460] for the rect. How can I change to [0,0,320,460]?

Thanks.
 
Thanks for the fast reply,

Yes UR right... the first line is absolutely useless. Thanks I'll remove.
Now I'm hacked UIHardware.h to my app (because it leaks from the official iPhone SDK).

CGRect fullscreenRect = [UIHardware fullScreenApplicationContentRect];
says [0,20,320,460] for the rect. How can I change to [0,0,320,460]?

Thanks.

sorry mate I had a slip of the brain there, you are right UIHardware isnt official in the SDK, remove the header from your app and just use:-

Code:
CGRect fullscreenRect = CGRectMake(0,0,320,480);
 
Yes yes... I know... but how to tell the hardware that use sp area and forward touch event to my app?

CGRect fullScreenRect = [UIHardware fullScreenApplicationContentRect];
CGSize mainScreenRect = [UIHardware mainScreenSize];
[UIHardware _setStatusBarHeight:0.0f];
fullScreenRect = [UIHardware fullScreenApplicationContentRect];
mainScreenRect = [UIHardware mainScreenSize];

this code sets the window to proper size but I still don't have touch events on the sp's area...

idea?
 
I did. Nothing changed...
It is an OpenGL app, based on GLSprite example (so I don't have UIViewController). Because lot of post around the web discussing almost this issue, but all of them has a ViewController, and dealing with the rotation issue. But I only want touch events from that region, as in OpenGL handling the screen rotation is very easy.

So? Do U've idea?

thanks
 
UIViewControllers aren't only for handling the rotation, as part of the MVC convention they are there to handle all of the control for the views that are within them, this includes handling touch events.

I'd use a view controller, you can choose that the view controller ignores any rotation events and still do it yourself
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.