ios - 在 mkMapView ios 中的单击按钮中发送对象
<p><p>在我的 Mapview 中,我有 sum 注释,annontion 有一个按钮,可以将我发送到另一个 View 以获取有关此注释的更多详细信息 </p>
<p>我的代码是</p>
<pre><code>myAnnotation *myAnn = (myAnnotation *)annotation;
UIButton *discloseButton = ;
;
annotationView.rightCalloutAccessoryView = discloseButton;
UIImageView *leftIconView = [ initWithImage:];
UIImage *pinImage = ;
;
annotationView.leftCalloutAccessoryView = leftIconView;
return annotationView;
</code></pre>
<p>和</p>
<pre><code>-(IBAction)showInfo:(id)sender
{
;
}
// envoie des données vers la detail d'une mission
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([ isEqualToString:@"aa"])
{
DetailViewController *detailviewcontroller = ;
detailviewcontroller.DetailModal = @[@"aa",@"aaa",@"aaa"];
}
}
</code></pre>
<p>如何通过单击按钮发送对象注释以填充我的表格 detailviewcontroller.DetailModal ?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以将所有数据发送到格式化字符串并在 <code>prepareForSegue</code></p> 中拆分您的字符串
<p>这样的代码</p>
<pre><code>myAnnotation *myAnn = (myAnnotation *)annotation;
UIButton *discloseButton = ;
;
NSString *detail = [NSString stringWithFormat:@"%@::%@::%@::%@::%@::%@::%@::%@::%@::%@::%@"
,myAnn.title,myAnn.description,myAnn.Latitude,myAnn.longitude,myAnn.image,myAnn.type,myAnn.ville,myAnn.point,myAnn.nombreDeVisite,myAnn.nbVTotal,myAnn.idMission];
discloseButton.accessibilityHint = detail;
annotationView.rightCalloutAccessoryView = discloseButton;
</code></pre>
<p>在你的函数中<code>prepareForSegue</code></p>
<pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([ isEqualToString:@"aa"])
{
UIButton *button = (UIButton *)sender;
NSArray* infos = ;
if ( > 1)
{
tit = ;
description = ;
Latitude = ;
longitude = ;
image = ;
type = ;
ville = ;
point = ;
nombreDeVisite = ;
nbVTotal = ;
idMission = ;
}
DetailViewController *detailviewcontroller = ;
detailviewcontroller.DetailModal = @;
}
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 在 mkMapView ios 中的单击按钮中发送对象,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/24000279/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/24000279/
</a>
</p>
页:
[1]