<bdo id='FCxM2'></bdo><ul id='FCxM2'></ul>
    1. <legend id='FCxM2'><style id='FCxM2'><dir id='FCxM2'><q id='FCxM2'></q></dir></style></legend>
      <tfoot id='FCxM2'></tfoot>

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

      2. 代表的几个 UIAlertViews

        时间:2023-07-28
        <tfoot id='RNwDy'></tfoot>
              <bdo id='RNwDy'></bdo><ul id='RNwDy'></ul>
            • <legend id='RNwDy'><style id='RNwDy'><dir id='RNwDy'><q id='RNwDy'></q></dir></style></legend>

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

                1. <i id='RNwDy'><tr id='RNwDy'><dt id='RNwDy'><q id='RNwDy'><span id='RNwDy'><b id='RNwDy'><form id='RNwDy'><ins id='RNwDy'></ins><ul id='RNwDy'></ul><sub id='RNwDy'></sub></form><legend id='RNwDy'></legend><bdo id='RNwDy'><pre id='RNwDy'><center id='RNwDy'></center></pre></bdo></b><th id='RNwDy'></th></span></q></dt></tr></i><div id='RNwDy'><tfoot id='RNwDy'></tfoot><dl id='RNwDy'><fieldset id='RNwDy'></fieldset></dl></div>
                    <tbody id='RNwDy'></tbody>
                2. 本文介绍了代表的几个 UIAlertViews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  目前我有一个类在此处和那里弹出 UIAlertView.目前,同一个类是这些的代表(这将是非常合乎逻辑的).不幸的是,这些 UIAlertView 将调用该类的相同委托方法.现在,问题是 - 你怎么知道委托方法是从哪个警报视图调用的?我想只检查警报视图的标题,但这并不优雅.处理多个 UIAlertView 最优雅的方法是什么?

                  Currently I've got a class popping up UIAlertViews here and there. Currently, the same class is the delegate for these (it's very logical that it would be). Unfortunately, these UIAlertViews will call the same delegate methods of the class. Now, the question is - how do you know from which alert view a delegate method is invoked? I was thinking of just checking the title of the alert view, but that isn't so elegant. What's the most elegant way to handle several UIAlertViews?

                  推荐答案

                  像这样标记 UIAlertView:

                  #define kAlertViewOne 1
                  #define kAlertViewTwo 2
                  
                  UIAlertView *alertView1 = [[UIAlertView alloc] init...
                  alertView1.tag = kAlertViewOne;
                  
                  UIAlertView *alertView2 = [[UIAlertView alloc] init...
                  alertView2.tag = kAlertViewTwo;
                  

                  然后使用这些标签在委托方法中区分它们:

                  and then differentiate between them in the delegate methods using these tags:

                  - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
                      if(alertView.tag == kAlertViewOne) {
                          // ...
                      } else if(alertView.tag == kAlertViewTwo) {
                          // ...
                      }
                  }
                  

                  这篇关于代表的几个 UIAlertViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:关于“声明仅在文件范围内有效" 下一篇:使用 KVO 与 NSNotificationCenter 观察对可变数组的更改

                  相关文章

                3. <small id='R96F2'></small><noframes id='R96F2'>

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

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

                  1. <tfoot id='R96F2'></tfoot>

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