如何在mkmapview IOS 7中移动合法链接

时间:2014-01-23 11:57:31

标签: ios7 mkmapview android-mapview

就像我们所知道的Apple一样,我们总是需要为每次更新改变一些东西。有人解决了地图法律链接的移动问题吗?

我尝试了很多方法来控制法律标签但是,它可以被隐藏吗? 我还能做什么?

提前致谢

3 个答案:

答案 0 :(得分:3)

您需要更改UIViewController的bottomLayoutGuide。使用以下代码创建一个类:

<强> MapLayoutGuide.h

@interface MapLayoutGuide : NSObject <UILayoutSupport>
-(id)initWithLength:(CGFloat)length;
@end

<强> MapLayoutGuide.m

#import "MapLayoutGuide.h"
@implementation MapLayoutGuide
@synthesize length = _length;

- (id)initWithLength:(CGFloat)length
{
    if (self = [super init]) 
    {
        _length = length;
    }
    return self;
}
@end

然后在你的UIViewController中显示地图,添加:

-(id <UILayoutSupport>)bottomLayoutGuide
{
    return [[MapLayoutGuide alloc] initWithLength:kMapViewBottomContentInset];
}

其中kMapViewBottomContentInset - 你想提升多少法律链接。通常是UITabBar的大小,如果你有的话。

即使您未在视图上使用AutoLayout,此解决方案仍然有效。

答案 1 :(得分:1)

您可以增加地图的高度,以便合法标签被其他视图或其他内容隐藏。我看到有些人在它上面放了一个“找我”按钮。我不认为有一种简单(或合法)的方式来重新定位或删除它。

答案 2 :(得分:0)

override func viewWillLayoutSubviews() {
    positionLegalMapLabel()
}

func positionLegalMapLabel() {
    let legalMapLabel = self.mapView.subviews[1]

    legalMapLabel.frame.origin = CGPointMake(self.mapView.bounds.size.width - legalMapLabel.frame.size.width - 7, legalMapLabel.frame.origin.y)
}