• <legend id='5UwPi'><style id='5UwPi'><dir id='5UwPi'><q id='5UwPi'></q></dir></style></legend>
    <tfoot id='5UwPi'></tfoot>

      <small id='5UwPi'></small><noframes id='5UwPi'>

      • <bdo id='5UwPi'></bdo><ul id='5UwPi'></ul>
    1. <i id='5UwPi'><tr id='5UwPi'><dt id='5UwPi'><q id='5UwPi'><span id='5UwPi'><b id='5UwPi'><form id='5UwPi'><ins id='5UwPi'></ins><ul id='5UwPi'></ul><sub id='5UwPi'></sub></form><legend id='5UwPi'></legend><bdo id='5UwPi'><pre id='5UwPi'><center id='5UwPi'></center></pre></bdo></b><th id='5UwPi'></th></span></q></dt></tr></i><div id='5UwPi'><tfoot id='5UwPi'></tfoot><dl id='5UwPi'><fieldset id='5UwPi'></fieldset></dl></div>

        导航栏左侧的按钮问题

        Issue with button on the left side of the uinavigation bar(导航栏左侧的按钮问题)
          • <bdo id='HzezH'></bdo><ul id='HzezH'></ul>

                  <tfoot id='HzezH'></tfoot>
                  <i id='HzezH'><tr id='HzezH'><dt id='HzezH'><q id='HzezH'><span id='HzezH'><b id='HzezH'><form id='HzezH'><ins id='HzezH'></ins><ul id='HzezH'></ul><sub id='HzezH'></sub></form><legend id='HzezH'></legend><bdo id='HzezH'><pre id='HzezH'><center id='HzezH'></center></pre></bdo></b><th id='HzezH'></th></span></q></dt></tr></i><div id='HzezH'><tfoot id='HzezH'></tfoot><dl id='HzezH'><fieldset id='HzezH'></fieldset></dl></div>
                  <legend id='HzezH'><style id='HzezH'><dir id='HzezH'><q id='HzezH'></q></dir></style></legend>
                    <tbody id='HzezH'></tbody>

                1. <small id='HzezH'></small><noframes id='HzezH'>

                  本文介绍了导航栏左侧的按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在导航栏的左侧有一个按钮.我在那个按钮附近还有一个 UIButton.

                  I have a button on the left side of the navigation bar. I also have a UIButton near that button.

                  现在,当我单击导航栏下方的按钮时,在许多情况下,导航栏上的按钮会被单击.

                  Now when I click the button thats below the navigation bar, in many cases, the button on the nab bar gets clicked.

                  知道为什么会这样吗?有什么建议吗?

                  Any idea why this is happening? Any suggestions ?

                  谢谢.

                  图片:如果您单击红色按钮内的任意位置,导航栏左上角的按钮仍会被按下.

                  image: if you click anywhere inside the red button, the top left button of the nav bar still gets pressed.

                  导航栏按钮代码:

                  UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
                  [leftButton setShowsTouchWhenHighlighted:NO];
                  [leftButton setImage:[UIImage imageNamed:@"deals.png"] forState:UIControlStateNormal];
                  [leftButton setImage:[UIImage imageNamed:@"deals_down.png"] forState:UIControlStateSelected];
                  [leftButton setImage:[UIImage imageNamed:@"deals_down.png"] forState:UIControlStateHighlighted];
                  [leftButton addTarget:self action:@selector(dealsButtonPressed:) forControlEvents:UIControlEventTouchDown || UIControlEventTouchUpInside];
                  self.navigationItem.leftBarButtonItem =  [[[UIBarButtonItem alloc] initWithCustomView:leftButton] autorelease];
                  [leftButton release];
                  

                  推荐答案

                  UINavigationButtons 的可点击区域比它的视图要大得多,Apple 这样做是为了便于使用.如果你真的想要两个彼此靠近的按钮,你必须继承 UINavigationBar,更具体地说,覆盖触摸事件,获取触摸坐标并按照你认为合适的方式行事.更多信息这里.

                  UINavigationButtons have a much larger tappable area than it's view, Apple made it this way for ease of use. If you really want to have two buttons that close to each other you have to subclass UINavigationBar, more specifically, override the touch events, get the touch coordinates and act as you see fit. More info here.

                  这篇关于导航栏左侧的按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UIButton title text color(UIButton 标题文本颜色)
                  Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                  Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                  How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                  iPhone UIButton - image position(iPhone UIButton - 图像位置)
                  UIButton remove all target-actions(UIButton 删除所有目标动作)
                    <tbody id='P1Wf8'></tbody>
                  <tfoot id='P1Wf8'></tfoot>

                      <i id='P1Wf8'><tr id='P1Wf8'><dt id='P1Wf8'><q id='P1Wf8'><span id='P1Wf8'><b id='P1Wf8'><form id='P1Wf8'><ins id='P1Wf8'></ins><ul id='P1Wf8'></ul><sub id='P1Wf8'></sub></form><legend id='P1Wf8'></legend><bdo id='P1Wf8'><pre id='P1Wf8'><center id='P1Wf8'></center></pre></bdo></b><th id='P1Wf8'></th></span></q></dt></tr></i><div id='P1Wf8'><tfoot id='P1Wf8'></tfoot><dl id='P1Wf8'><fieldset id='P1Wf8'></fieldset></dl></div>

                    1. <legend id='P1Wf8'><style id='P1Wf8'><dir id='P1Wf8'><q id='P1Wf8'></q></dir></style></legend>

                      <small id='P1Wf8'></small><noframes id='P1Wf8'>

                            <bdo id='P1Wf8'></bdo><ul id='P1Wf8'></ul>