所以我正在使用这个电话:
mapView.showAnnotations(annotations, animated: true)
为应用设置动画以显示注释。这很好用。我需要的是告诉地图在我打电话时通常缩放的区域左侧添加100像素的填充:
mapView.setVisibleMapRect(mapRect, edgePadding: UIEdgeInsetsMake(20, 100, 20, 20), animated: true)
我查看了屏幕左侧的地图,我不希望注释出现在下面,所以,我想在它们的左边添加填充,这样它们就不会被视图隐藏了。
我尝试了MKMapView调用“setRegion”和:
mapView.showAnnotations(annotations, animated: true)
但是,当我尝试合并:
时,它并没有真正起作用mapView.setVisibleMapRect(mapRect, edgePadding: UIEdgeInsetsMake(20, 100, 20, 20), animated: true)
和
Sub Merge()
With Worksheets("Sheet2")
Dim bookList As Workbook
Dim MergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Dim sCURFolderPath As String
Dim sHostFolder As String
Application.ScreenUpdating = False
Set MergeObj = CreateObject("Scripting.FileSystemObject")
'change folder path of excel files here
sCURFolderPath = Application.ActiveWorkbook.Path ' Current directory folder
sHostFolder = sCURFolderPath & "\First Month"
Set dirObj = MergeObj.GetFolder(sHostFolder)
Set filesObj = dirObj.Files
For Each everyObj In filesObj
Set bookList = Workbooks.Open(everyObj)
Range("A2:Z" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets("Sheet2").Activate
Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
bookList.Close
Next
End With
End Sub
实现这一目标的正确方法是什么?
答案 0 :(得分:6)
对我来说最有效的是一行代码:
mapView.layoutMargins = UIEdgeInsetsMake(0, 100, 0, 60)
所以这允许我像往常一样使用地图并让地图自动处理所有关于合并设置的布局逻辑,因此没有注释放在我在地图上的左视图下。