How to move legal link in mkmapview IOS 7

依然范特西╮ 提交于 2019-12-26 03:08:08

问题


as all we know Apple, we always need to change something for each update. Did somebody solve the moving problem for map legal link?

I tried many ways to control legal label but, just it can be hidden? what else I can do?

thanks in advance


回答1:


You need to change bottomLayoutGuide for your UIViewController. Create a class with following code:

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

And then in your UIViewController, that is displaying map, add this:

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

where kMapViewBottomContentInset - how much do you want to lift up Legal link. Typically size of UITabBar, if you have one.

This solution works even if you don't use AutoLayout on your view.




回答2:


You can increase the height of the map so that the legal label is hidden by another view or something. I saw that some people placed a "locate me" button on top of it. I don't think that there is an easy (or legal) way to reposition or remove it.




回答3:


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)
}


来源:https://stackoverflow.com/questions/21307481/how-to-move-legal-link-in-mkmapview-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!