Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 555917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:51:54+00:00 2026-05-13T11:51:54+00:00

I have a custom button in another view directly above my UITabBar. It seems

  • 0

I have a custom button in another view directly above my UITabBar. It seems like there’s a hidden “hit area” above the UITTabBar that is preventing me from hitting the bottom half of my custom button in another view. The button subview is on top of all other views including the custom UITabBar.

It’s really easy to notice this effect in the simulator using the UICatalog sample code. Head to the toolbar section. Position your mouse cursor about 5-10 pixels above the tool bar items on the bottom and click to see that you can trigger the touch event way above the button.

I need to figure out how to restrict this hit area to the bounds of the uitoolbar or uitabbar itself and not let the iPhone do any sort of hit accessibility magic.

I think I’ve exhausted all options :\ I thought clipsToBounds (on the UITabBar) would do the trick, but apparently not.

Also I’m doing this completely in code, so no Interface Builder…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:51:55+00:00Added an answer on May 13, 2026 at 11:51 am

    For anyone who stumbles across this question, I have a solution for this, although it falls well into “dirty hack” territory, and may break with newer (than 3.0) iPhone OS releases… use at your peril!

    I created a UITabBar category with a hitTest:withEvent: implementation, and noticed when I set a breakpoint in the body of this method that the x,y values in the supplied CGPoint struct were rather odd – when touching in the ~15px or so ABOVE the tab bar the values look something like (x=23.482749, y=12.938475), whereas if you touch within the tab bar the values were nicely rounded to the nearest integer, e.g. (x=23, y=12).

    Now, for some reason I was expecting the touches in the ~15px “hit zone” above the tab bar to be negative for the y axis (which is why I started down this path in the first place), but alas, no. You can touch in two different places and get similar coordinates, such as in the example above.

    So, my “solution”: I’m relying on a touch in the tab bar itself always having an integer-rounded value for the y axis, otherwise I’m assuming it’s in the overlap zone above the tab bar. I tested this for quite a while, and it seems to consistently behave this way.

    The code:

    @implementation UITabBar (Me)
    
    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event 
    {
      if ([[NSString stringWithFormat:@"%.6f", point.y] hasSuffix:@".000000"])
      {
        return [super hitTest:point withEvent:event];
      }
      else
      {
        return nil;
      }
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create a custom compound button bar control in Android like the
I have a list view with custom adapter, with an Image Button and a
There seems to be something holding a reference to my custom button, MyButton (which
I have made a custom suface button according this example: <Button> <Button.Template> <ControlTemplate TargetType=Button>
I have custom server control contains templatefield when an out button clicked the field
I have a sheet with a custom button on it from where I control
I'm making a custom button (Winforms Control Library) and have the code below so
Check out this jsbin . I have a form with a custom button that
I have a custom ButtonUI class that paints the button. Before drawing the text,
I have a custom control that displays a tryAgain button when the control is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.