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

      <tfoot id='L3yjx'></tfoot>

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

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

      2. 为 UIButton 添加目标 - iOS

        Add target for UIButton - iOS(为 UIButton 添加目标 - iOS)

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

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

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

                  <tbody id='x8iYb'></tbody>
                  <tfoot id='x8iYb'></tfoot>

                • 本文介绍了为 UIButton 添加目标 - iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  任何人都可以帮助我了解如何添加操作以使用 UIButton 调用以下方法.

                  Anyoone can help me on how to add action to call the following method using UIButton.

                  -(void)navigatePics:(id)sender andIndex:(NSInteger *)index{}
                  

                  推荐答案

                  使用 button.setTag:(NSInteger) 方法将索引作为标签添加到 UIButton.

                  Use the button.setTag:(NSInteger) method to add the index to the UIButton as a tag.

                  UIButton *button = ...;
                  [button setTag:1234];
                  [button addTarget:self action:@selector(navigatePics:) forControlEvents:UIControlEventTouchUpInside];
                  

                  然后在 navigatePics 中读取标签.

                  Then in navigatePics, read the tag.

                  -(void)navigatePics:(UIButton *)sender
                  {
                   int index = sender.tag;
                   // index = 1234;
                  }
                  

                  这篇关于为 UIButton 添加目标 - iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 删除所有目标动作)

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

                        <tbody id='K0aQj'></tbody>

                        <bdo id='K0aQj'></bdo><ul id='K0aQj'></ul>
                          <tfoot id='K0aQj'></tfoot>

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

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