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

      <legend id='1sOHR'><style id='1sOHR'><dir id='1sOHR'><q id='1sOHR'></q></dir></style></legend>

      <tfoot id='1sOHR'></tfoot>

      1. <small id='1sOHR'></small><noframes id='1sOHR'>

        在 clickedButtonAtIndex 中显示警报?

        Show Alert in clickedButtonAtIndex?(在 clickedButtonAtIndex 中显示警报?)
      2. <i id='UC4E3'><tr id='UC4E3'><dt id='UC4E3'><q id='UC4E3'><span id='UC4E3'><b id='UC4E3'><form id='UC4E3'><ins id='UC4E3'></ins><ul id='UC4E3'></ul><sub id='UC4E3'></sub></form><legend id='UC4E3'></legend><bdo id='UC4E3'><pre id='UC4E3'><center id='UC4E3'></center></pre></bdo></b><th id='UC4E3'></th></span></q></dt></tr></i><div id='UC4E3'><tfoot id='UC4E3'></tfoot><dl id='UC4E3'><fieldset id='UC4E3'></fieldset></dl></div>

        <tfoot id='UC4E3'></tfoot>

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

              <legend id='UC4E3'><style id='UC4E3'><dir id='UC4E3'><q id='UC4E3'></q></dir></style></legend>
                <bdo id='UC4E3'></bdo><ul id='UC4E3'></ul>

                    <tbody id='UC4E3'></tbody>

                1. 本文介绍了在 clickedButtonAtIndex 中显示警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述


                  我需要在用户按下 buttonIndex 1 后显示确认警报,但是......如果我在 clickedButtonAtIndex 中使用 popViewcontroller 它会崩溃而没有错误.


                  i need to show a confirm alert after the user press buttonIndex 1 but... if i use popViewcontroller in clickedButtonAtIndex it crash without errors.

                  问题是

                  [self.navigationController popViewControllerAnimated:YES];
                  

                  在第二次警报点击之前调用...

                  is called before second Alert click...

                  如何解决?

                  这是我的代码:

                  - (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
                      if (buttonIndex == 1) {
                          UIAlertView *alert = 
                              [[UIAlertView alloc] initWithTitle:@"OK!"
                                                      message:@"Completed"
                                                      delegate:self 
                                      cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                              [alert show]; 
                              [alert release];
                  
                              [self.navigationController popViewControllerAnimated:YES];
                      }
                  }
                  

                  推荐答案

                  将两个UIAlertView的标签属性分别设置为1和2.然后,在委托方法中,使用 if 语句检查 UIAlertView 参数的标记.

                  Set the tag properties of the two UIAlertViews to 1 and 2, respectively. Then, in the delegate method, use if statements to check the tag of the UIAlertView argument.

                  例子:

                  - (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
                  {
                      if (alertView.tag == 1)
                      {
                          //check the button index
                          //create and display the other alert view (set the tag property here to 2)
                      }
                      else if (alertView.tag == 2)
                      {
                          //pop the view controller
                      }
                  }
                  

                  这篇关于在 clickedButtonAtIndex 中显示警报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  Show UITabBar when UIViewController pushed(推送 UIViewController 时显示 UITabBar)
                2. <tfoot id='LvADB'></tfoot>

                    <tbody id='LvADB'></tbody>

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

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