iPhone touch rect / status pane area

Discussion in 'iOS Programming' started by benceb, Sep 22, 2008.

  1. benceb macrumors newbie

    Joined:
    Sep 22, 2008
    #1
    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];
     
  2. mccannmarc macrumors 6502

    mccannmarc

    Joined:
    Aug 15, 2008
    Location:
    Manchester, UK
    #2
    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];
     
  3. benceb thread starter macrumors newbie

    Joined:
    Sep 22, 2008
    #3
    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.
     
  4. mccannmarc macrumors 6502

    mccannmarc

    Joined:
    Aug 15, 2008
    Location:
    Manchester, UK
    #4
    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);
     
  5. benceb thread starter macrumors newbie

    Joined:
    Sep 22, 2008
    #5
    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?
     
  6. mccannmarc macrumors 6502

    mccannmarc

    Joined:
    Aug 15, 2008
    Location:
    Manchester, UK
    #6
    You need to set both of the Rects you are declaring to be the size of the screen that is {0,0,320,480}
     
  7. benceb thread starter macrumors newbie

    Joined:
    Sep 22, 2008
    #7
    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
     
  8. mccannmarc macrumors 6502

    mccannmarc

    Joined:
    Aug 15, 2008
    Location:
    Manchester, UK
    #8
    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
     

Share This Page