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

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

        在 UIButton 的选择器上传递参数

        Pass parameter on selector of UIButton(在 UIButton 的选择器上传递参数)
        <i id='TnCxr'><tr id='TnCxr'><dt id='TnCxr'><q id='TnCxr'><span id='TnCxr'><b id='TnCxr'><form id='TnCxr'><ins id='TnCxr'></ins><ul id='TnCxr'></ul><sub id='TnCxr'></sub></form><legend id='TnCxr'></legend><bdo id='TnCxr'><pre id='TnCxr'><center id='TnCxr'></center></pre></bdo></b><th id='TnCxr'></th></span></q></dt></tr></i><div id='TnCxr'><tfoot id='TnCxr'></tfoot><dl id='TnCxr'><fieldset id='TnCxr'></fieldset></dl></div>

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

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

                  <tbody id='TnCxr'></tbody>
                  <bdo id='TnCxr'></bdo><ul id='TnCxr'></ul>

                • 本文介绍了在 UIButton 的选择器上传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 MKAnnotation 的标注上有一个 detailDisclousure 按钮.当按下这个按钮时,我需要调用一个方法,传递一个参数,该参数标识调用它的 annotation.怎么可能?

                  I have a detailDisclousure button on the callout of a MKAnnotation. When this button is pressed I need to call a method passing a parameter that identifies the annotation that called it. How could it be done?

                  这是我对注解的看法:

                  - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
                  {
                  
                  if ([annotation isKindOfClass:[Annotation class]])
                  {
                      static NSString* identifier = @"identifier";
                  
                      MKPinAnnotationView* pinView = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
                  
                      if (pinView == nil) 
                      {
                          pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]autorelease];
                      }
                  
                      Annotation *antt = annotation;
                  
                      pinView.canShowCallout = YES;
                      pinView.draggable =    YES;
                  
                      UIButton* detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
                  
                      [detailButton performSelector:@selector(goToViewWithAnnotation:) withObject:antt];
                  
                      pinView.rightCalloutAccessoryView = detailButton;
                  
                      return pinView;
                  }
                  
                  else 
                  {
                      return nil; 
                  }
                  }
                  

                  这是应该使用参数调用的方法:

                  And this is the method that should be called with the parameter:

                  -(void)goToViewWithAnnotation:(Annotation *)annotation
                  {
                      NextViewController *nextView = [[NextViewController alloc]initWithNibName:@"NextViewController" bundle:nil];
                  
                  nextView.id = annotation.id;
                  
                  [self.navigationController nextView animated:YES];
                  }
                  

                  推荐答案

                  您可以通过 UIButtontag 属性传递任何 NSInteger仅限.

                  you can pass any NSInteger via the tag property of the UIButton only.

                  这篇关于在 UIButton 的选择器上传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='UJd5s'><tr id='UJd5s'><dt id='UJd5s'><q id='UJd5s'><span id='UJd5s'><b id='UJd5s'><form id='UJd5s'><ins id='UJd5s'></ins><ul id='UJd5s'></ul><sub id='UJd5s'></sub></form><legend id='UJd5s'></legend><bdo id='UJd5s'><pre id='UJd5s'><center id='UJd5s'></center></pre></bdo></b><th id='UJd5s'></th></span></q></dt></tr></i><div id='UJd5s'><tfoot id='UJd5s'></tfoot><dl id='UJd5s'><fieldset id='UJd5s'></fieldset></dl></div>
                  <tfoot id='UJd5s'></tfoot>

                      <tbody id='UJd5s'></tbody>
                      <bdo id='UJd5s'></bdo><ul id='UJd5s'></ul>
                          <legend id='UJd5s'><style id='UJd5s'><dir id='UJd5s'><q id='UJd5s'></q></dir></style></legend>
                        • <small id='UJd5s'></small><noframes id='UJd5s'>