<tfoot id='nNZFE'></tfoot>
  • <small id='nNZFE'></small><noframes id='nNZFE'>

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

    1. <legend id='nNZFE'><style id='nNZFE'><dir id='nNZFE'><q id='nNZFE'></q></dir></style></legend>
      1. 如何增加 UIButton 的选择区域?

        时间:2023-07-08

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

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

                • 本文介绍了如何增加 UIButton 的选择区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我以编程方式制作了 UIButton

                  I have made the UIButton programmatically

                  togglebutton = [UIButton buttonWithType:UIButtonTypeCustom];
                  togglebutton.frame = CGRectMake(42, 15, 80, 21);
                  [togglebutton addTarget:self action:@selector(toggleview)   
                  forControlEvents:UIControlEventTouchUpInside];
                  [togglebutton setImage:[UIImage imageNamed:@"squ.png"] forState:UIControlStateNormal];
                  [buttonView addSubview:togglebutton];
                  

                  在上图中,它看起来像右边的按钮.现在的要求是这个按钮的选择区域应该大于uibutton图像.这样用户就可以通过触摸特定按钮附近的区域来轻松单击按钮.

                  It is looked as the right button in above image. Now the requirement is that the selection area of this button should be more than then the uibutton image. So that the user will be able to click the button easily by touching on near by area of particular button.

                  [togglebutton setImageEdgeInsets: UIEdgeInsetsMake( 0, -30, 0, -25)];
                  

                  我尝试设置 image inset,但它使 image 不规则.请关注这个问题.

                  I tried to set the image inset but it making the image irregular. Please look upon this issue.

                  推荐答案

                  可以通过设置按钮的contentEdgeInsets来实现,例如:

                  You can achieve this by setting the button's contentEdgeInsets, for example:

                  toggleButton.contentEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0); //set as you require 
                  

                  这篇关于如何增加 UIButton 的选择区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 Swift 中为多个按钮使用一个 IBAction? 下一篇:无法在 UITableview 中的单元格内单击 UIButton

                  相关文章

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

                  1. <tfoot id='9x3Kx'></tfoot>
                  2. <legend id='9x3Kx'><style id='9x3Kx'><dir id='9x3Kx'><q id='9x3Kx'></q></dir></style></legend>
                  3. <small id='9x3Kx'></small><noframes id='9x3Kx'>