首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IOS地图法律文本更改位置与地图旋转

IOS地图法律文本更改位置与地图旋转
EN

Stack Overflow用户
提问于 2014-03-18 11:59:39
回答 1查看 165关注 0票数 1

我正在使用answer os this post更改屏幕上的地图法律文本位置(将其放在屏幕的右上角)。它工作得很好,但当地图旋转时,它就失败了。

我尝试在下面的方法中插入代码,以获得旋转的结束:

代码语言:javascript
复制
- (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated

但法律文本返回到其原始位置(左下角)。

如何在轮换结束后再次移动法律文本?

EN

回答 1

Stack Overflow用户

发布于 2014-07-08 21:09:23

在viewDidAppear中添加以下内容以更改合法标签位置

UILabel *attributionLabel = [mapView.subviews objectAtIndex:1]; attributionLabel.center = CGPointMake(attributionLabel.center.x, attributionLabel.center.y - 44.0f);

或者使用topLayoutGuide和bottomLayoutGuide的另一种解决方案

.h

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

.m

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

用法:

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22470101

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档