Commit 43b8edb2 authored by lujunye's avatar lujunye

调整地图显示

parent 4ecc9c91
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
......
......@@ -115,34 +115,35 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
titleLbl = UILabel()
titleLbl?.textColor = UIColor.black
titleLbl?.font = UIFont.systemFont(ofSize: 13)
titleLbl?.numberOfLines = 0
introView?.addSubview(titleLbl!)
contentLbl = UILabel()
contentLbl?.textColor = UIColor.lightGray
contentLbl?.font = UIFont.systemFont(ofSize: 11)
contentLbl?.numberOfLines = 0
contentLbl?.lineBreakMode = .byCharWrapping
introView?.addSubview(contentLbl!)
}
titleLbl!.text = response.pois.first?.name
// contentLbl!.text = "contentLbl?.textColor = UIColor.lightGraycontentLbl?.font = UIFont.systemFont(ofSize: 11)contentLbl?.numberOfLines = 0introView?.addSubview(contentLbl!)"
contentLbl!.text = "\(String(describing: response.pois.first!.province!))\(String(describing: response.pois.first!.city!))\(String(describing: response.pois.first!.district!))\( String(describing: response.pois.first!.address!))"
let t = getStrHeight(str: titleLbl!.text!, fontSize: 13)
let c = getStrHeight(str: contentLbl!.text!, fontSize: 11)
let h = t+c
titleLbl?.snp_updateConstraints({ (make) in
make.top.equalTo(7)
make.left.equalTo(10)
make.right.equalTo(-10)
make.height.equalTo(18.5)
make.height.equalTo(t)
})
contentLbl?.sizeToFit()
contentLbl?.snp_updateConstraints({ (make) in
make.top.equalTo(20)
make.top.equalTo(titleLbl!.snp.bottom).offset(5)
make.left.equalTo(10)
make.right.equalTo(-10)
make.bottom.equalTo(7)
make.height.equalTo(c)
})
let lbl = UILabel()
......@@ -155,28 +156,29 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
lbl2.font = UIFont.systemFont(ofSize: 13)
lbl2.sizeToFit()
var w = lbl.bounds.size.width
if w < lbl2.bounds.size.width {
w = lbl2.bounds.size.width
var w = lbl.bounds.size.width + 20
if w < lbl2.bounds.size.width + 20 {
w = lbl2.bounds.size.width + 20
}
if w > fullScreenWidth * 0.75 {
w = fullScreenWidth * 0.75 + 20
}
introView?.snp_updateConstraints({ (make) in
make.centerX.equalTo(MapBgView.snp_centerX)
make.centerY.equalTo(MapBgView.snp_centerY).offset(-(t+c+35))
make.centerY.equalTo(MapBgView.snp_centerY).offset(-(h+45))
make.width.equalTo(w)
make.height.equalTo(t+c+20)
make.height.equalTo(h+20)
})
}
func getStrHeight(str:String,fontSize:CGFloat) -> CGFloat{
let lbl = UILabel()
lbl.text = str
lbl.font = UIFont.systemFont(ofSize: fontSize)
lbl.font = UIFont.systemFont(ofSize: fontSize+2)
lbl.sizeToFit()
var w = lbl.bounds.size.width
if w > fullScreenWidth * 0.75 {
......@@ -185,7 +187,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
let viewSize = CGSize(width:w , height: CGFloat(MAXFLOAT))
let font = UIFont.systemFont(ofSize: 13)
let font = UIFont.systemFont(ofSize: fontSize+2)
return (str as NSString).boundingRect(with: viewSize, options: [.usesLineFragmentOrigin], attributes: [NSAttributedString.Key.font:font], context: nil).height
}
//移动后刷新
......@@ -195,7 +197,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
req.location = AMapGeoPoint.location(withLatitude: CGFloat(mapView.centerCoordinate.latitude), longitude: CGFloat(mapView.centerCoordinate.longitude))
req.requireExtension = true
search.aMapPOIAroundSearch(req)
print(mapView.centerCoordinate.latitude,mapView.centerCoordinate.longitude,bd_encrypt(gg_lat: mapView.centerCoordinate.latitude, gg_lon: mapView.centerCoordinate.longitude))
}
var annotation:MAPointAnnotation? = nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment