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

      2. <legend id='1P802'><style id='1P802'><dir id='1P802'><q id='1P802'></q></dir></style></legend>
      3. 自定义 UIAlertView 上的按钮

        Customizing the buttons on a UIAlertView(自定义 UIAlertView 上的按钮)

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

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

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

                <tbody id='hhjqN'></tbody>
            • <tfoot id='hhjqN'></tfoot>
                  <bdo id='hhjqN'></bdo><ul id='hhjqN'></ul>
                • 本文介绍了自定义 UIAlertView 上的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我自定义按钮的当前方式:

                  This is the current way i'm customizing my buttons:

                  UIAlertView *av = [[UIAlertView alloc] init];
                  
                  [av addButtonWithTitle:@""];
                  UIButton *yesButton = [av.subviews lastObject];
                  
                  [av show];
                  
                  [yesButton setImage:[UIImage imageNamed:@"test.png"] forState:UIControlStateNormal];
                  

                  这样做的问题是原始视图在我为按钮设置的图像周围仍然可见.它没有完全封装图像.这是我到目前为止的一个例子:

                  The problem with this is that the original view is still visible around the image I set for the button. It doesn't completely encapsulate the image. Here's an example of what I have so far:

                  https://www.dropbox.com/s/htb9pfihwmel5oo/testimage.png

                  有没有办法让图片完全占据整个按钮?

                  Is there anyway to make it so that the image completely takes up the entire button?

                  推荐答案

                  如果您不想要像 Sly Raskal 的答案那样健壮的东西,并且只想快速破解,那么它的工作方式类似于您现有的代码.你可以做这样的事情..当然你可以改变新的按钮框架来匹配你想要的.此外,您必须将 UIAlertView 定义为一个变量,以便您可以引用它,并在您的 someAction: 方法中将其关闭.

                  If you wan't something that's not as robust as Sly Raskal's answer and just want a quick hack, that works similar to your existing code. You could do something like this..Of course you can change the new buttons frame to match how you want it. Also, you would have to define the UIAlertView as a variable to so you have a reference to it, and dismiss it in your someAction: method.

                  UIAlertView *av = [[UIAlertView alloc] init];
                  [av addButtonWithTitle:@""];
                  UIButton *yesButton = [av.subviews lastObject];
                  [yesButton setHidden:YES];
                  
                  UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
                  [av addSubview:button];
                  [av show];
                  
                  [button setImage:[UIImage imageNamed:@"test.png"] forState:UIControlStateNormal];
                  [button addTarget:av action:@selector(someAction:) forControlEvents:[yesButton allControlEvents]];
                  [button setFrame:yesButton.frame];
                  

                  这篇关于自定义 UIAlertView 上的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

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

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

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

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

                              <tbody id='Fyi0l'></tbody>

                          • <tfoot id='Fyi0l'></tfoot>