• <legend id='uRzyJ'><style id='uRzyJ'><dir id='uRzyJ'><q id='uRzyJ'></q></dir></style></legend>

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

        • <bdo id='uRzyJ'></bdo><ul id='uRzyJ'></ul>

        iPhone:制作箭头形状的 UIBarButtonItem

        时间:2023-06-12

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

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

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

                • 本文介绍了iPhone:制作箭头形状的 UIBarButtonItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在导航栏上有一个 UIBarButtonItem.我想把它做成箭头形状.我的意思是我希望它是方形的,除了尖的一面.有谁知道怎么做?

                  I have a UIBarButtonItem on a navigation bar. I'd like to make it arrow shaped. By that I mean I want it to be square except for a pointy side. Does anyone know how to do this?

                  谢谢!

                  推荐答案

                  我在这个问题上尝试了几种方法,最后通过多个来源的所有答案找到了答案.有几个技巧;此代码段将显示所有内容(我正在创建自定义 rightNavButton,但您可以轻松地将其调整为任何 UIBarButtonItem):

                  I wrestled with several approaches on this one and finally figured it out using all the answers from several sources. There are a couple of tricks; this snippet will show it all (I was creating a custom rightNavButton, but you can adapt this easily for any UIBarButtonItem):

                  // Produces a nice "right arrow" style button that mirrors the back arrow
                  // automatically added by the navController
                  //
                  UIImage *buttonImage = [UIImage imageNamed:@"forwardButton.png"];
                  UIButton *forwardButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  [forwardButton setBackgroundImage:buttonImage forState:UIControlStateNormal];
                  [forwardButton setTitle:@"Meter" forState:UIControlStateNormal];
                  forwardButton.font = [UIFont boldSystemFontOfSize:12];
                  forwardButton.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);
                  [forwardButton addTarget:self action:@selector(showMeter) 
                             forControlEvents:UIControlEventTouchUpInside];
                  
                  self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
                             initWithCustomView:forwardButton];
                  

                  注意:事实证明,如果您在使用 UIButton 分配自定义视图后尝试直接在按钮项上设置目标和操作,则不会采取 - 您必须设置按钮本身的目标和操作 - 显然 navBar 使用逐字提供的按钮.

                  Note: it turns out that if you try to set the target and action directly on the button item after assigning a custom view using a UIButton that it won't take - you have to set the target and action on the button itself - apparently the navBar uses the button provided verbatim.

                  这是我在不透明黑色 navBar 上使用的图像(显然你可以使用任何东西):http://raretiger.com/images/forwardbutton.png

                  This is the image I was using on the opaque black navBar (you can use anything, obviously): http://raretiger.com/images/forwardbutton.png

                  这篇关于iPhone:制作箭头形状的 UIBarButtonItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:NSGenericException', reason: '只有当源控制器由 UINavigationC 下一篇:UINavigationController popToRootViewController,然后立即推送新视图

                  相关文章

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

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

                      <legend id='wZseq'><style id='wZseq'><dir id='wZseq'><q id='wZseq'></q></dir></style></legend>