Press through UIView?

Discussion in 'iPhone/iPad Programming' started by Danneman101, Oct 27, 2009.

  1. macrumors 6502

    Joined:
    Aug 14, 2008
    #1
    Im wondering if its possible to press right through a UIView?

    I would like to have a button in the underlying view to recieve the press, but instead the view that is displayed on top is impeding this.

    The view is placed on top of the underlying view using addSubview, so the underlying view is not pushed away or anything.

    Possible?
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Certainly.

    Hint: So what you're saying is that you don't want to enable user interaction for your UIView, is that right?
     
  3. thread starter macrumors 6502

    Joined:
    Aug 14, 2008
    #3
    Great, that was the clue I needed - thanks a lot :)

    Code:
    UIView *myView = [[UIView alloc] initWithFrame:frame]; // main view
    [view addSubview:myView2]; // subview
    [myView2 setUserInteractionEnabled:NO]; // disable interaction with subview
    
     

Share This Page