相关疑难解决方法(0)

如何为MKAnnotation的字幕显示2行文本并更改右侧按钮的图像?

我正在查看Apple的MapCallouts示例,用于地图注释和标注(==当您点击图钉时出现的气泡).每个注释都有坐标,标题和副标题.我想在2行显示字幕,我试过:

- (NSString *)subtitle
{
return @"Founded: June 29, 1776\nSecond line text";
}
Run Code Online (Sandbox Code Playgroud)

但文本"第二行文字"保持在一行,使泡沫更宽.我明白了:

在此输入图像描述

我还想将按钮的图像更改为我自己的图像,设置按钮的代码当前是这样的:

UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

编辑:我尝试了7KV7的建议.按钮更改成功,但我仍然无法获得2行字幕.我的代码:

MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc]
                                        initWithAnnotation:annotation reuseIdentifier:BridgeAnnotationIdentifier] autorelease];
        customPinView.pinColor = MKPinAnnotationColorPurple;
        customPinView.animatesDrop = YES;


        // Button
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake(0, 0, 23, 23);
        button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;

        //UIEdgeInsets titleInsets = UIEdgeInsetsMake(7.0, -20.0, 7.0, 7.0);
        //button.titleEdgeInsets = titleInsets;

        [button setImage:[UIImage imageNamed:@"ic_phone_default.png"] forState:UIControlStateNormal];
        //[button setImage:[UIImage imageNamed:@"ic_phone_selected.png"] forState:UIControlStateSelected];
        [button setImage:[UIImage imageNamed:@"ic_phone_selected.png"] forState:UIControlStateHighlighted];
        [button addTarget:self action:@selector(showDetails:) …
Run Code Online (Sandbox Code Playgroud)

iphone mkmapview mkannotation

14
推荐指数
2
解决办法
3万
查看次数

Monotouch MapKit - 注释 - 为泡泡添加按钮

任何人都知道是否有一个按钮到注释?

我希望这个位置可以选择 - 所以你可以说..选择位置并通过点击按钮获取该位置的所有事件.

这可能吗?

女://

iphone mapkit xamarin.ios

7
推荐指数
2
解决办法
9391
查看次数

iOS映射GPS位置,在地图上实现蓝球位置和箭头标志

1.)我需要在地图上有一个蓝色的圆圈/位置点,如下所示.

  • 这叫什么?
  • 我该如何实现它?

在此输入图像描述

2.)如何在弹出屏幕上显示如下箭头?
在此输入图像描述

gps objective-c mapkit ios

3
推荐指数
1
解决办法
5753
查看次数

标签 统计

iphone ×2

mapkit ×2

gps ×1

ios ×1

mkannotation ×1

mkmapview ×1

objective-c ×1

xamarin.ios ×1