Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
e3c17213
Commit
e3c17213
authored
Jul 28, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搜索界面
parent
43b8edb2
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
15 deletions
+94
-15
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/ViewController/货拉拉/收发货地址/ToAndFormSelectViewController.swift
...wController/货拉拉/收发货地址/ToAndFormSelectViewController.swift
+94
-15
GeliBusinessPlatform/ViewController/货拉拉/收发货地址/ToAndFormSelectViewController.xib
...iewController/货拉拉/收发货地址/ToAndFormSelectViewController.xib
+0
-0
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
e3c17213
No preview for this file type
GeliBusinessPlatform/ViewController/货拉拉/收发货地址/ToAndFormSelectViewController.swift
View file @
e3c17213
...
@@ -13,7 +13,7 @@ import AMapFoundationKit
...
@@ -13,7 +13,7 @@ import AMapFoundationKit
import
MAMapKit
import
MAMapKit
import
AMapSearchKit
import
AMapSearchKit
import
IQKeyboardManagerSwift
import
IQKeyboardManagerSwift
class
ToAndFormSelectViewController
:
BaseViewController
,
MAMapViewDelegate
,
CLLocationManagerDelegate
,
AMapSearchDelegate
{
class
ToAndFormSelectViewController
:
BaseViewController
,
MAMapViewDelegate
,
CLLocationManagerDelegate
,
AMapSearchDelegate
,
UISearchBarDelegate
,
SearchBarViewDelegate
{
@IBOutlet
weak
var
navBgView
:
UIView
!
@IBOutlet
weak
var
navBgView
:
UIView
!
@IBOutlet
weak
var
citySelectBtn
:
UIButton
!
@IBOutlet
weak
var
citySelectBtn
:
UIButton
!
...
@@ -34,14 +34,40 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -34,14 +34,40 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
var
lng
:
CLLocationDegrees
=
0
var
lng
:
CLLocationDegrees
=
0
var
manger
:
CLLocationManager
=
CLLocationManager
()
var
manger
:
CLLocationManager
=
CLLocationManager
()
func
locationManager
(
_
manager
:
CLLocationManager
,
didUpdateLocations
locations
:
[
CLLocation
])
{
@IBOutlet
weak
var
lineX
:
NSLayoutConstraint
!
manger
.
stopUpdatingLocation
()
@IBOutlet
weak
var
closeBtn
:
UIButton
!
let
location
=
locations
.
last
@IBAction
func
closeAction
(
_
sender
:
Any
)
{
lat
=
location
?
.
coordinate
.
latitude
as!
CLLocationDegrees
closeBtn
.
isHidden
=
true
lng
=
location
?
.
coordinate
.
longitude
as!
CLLocationDegrees
listViewBG
.
isHidden
=
true
initMapView
(
lat
:
lat
,
lng
:
lng
)
IQKeyboardManager
.
shared
.
resignFirstResponder
()
initSearch
()
}
@IBOutlet
weak
var
rightBtn
:
UIButton
!
@IBOutlet
weak
var
leftBtn
:
UIButton
!
@IBAction
func
listViewRefresh
(
_
sender
:
UIButton
)
{
if
sender
==
leftBtn
{
leftBtn
.
isSelected
=
true
rightBtn
.
isSelected
=
false
lineX
.
constant
=
0
}
else
{
leftBtn
.
isSelected
=
false
rightBtn
.
isSelected
=
true
lineX
.
constant
=
fullScreenWidth
*
0.5
}
}
}
@IBOutlet
weak
var
listViewBG
:
UIView
!
@IBAction
func
backToUserLocation
(
_
sender
:
Any
)
{
}
override
func
viewDidLayoutSubviews
()
{
super
.
viewDidLayoutSubviews
()
listViewBG
.
layer
.
cornerRadius
=
5
listViewBG
.
layer
.
maskedCorners
=
[
CACornerMask
.
layerMinXMinYCorner
,
CACornerMask
.
layerMaxXMinYCorner
]
}
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
...
@@ -56,12 +82,25 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -56,12 +82,25 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
}
}
searchBr
.
placeholderStr
=
"从哪儿发货"
searchBr
.
placeholderStr
=
"从哪儿发货"
searchBr
.
cornerRadius
=
35
/
2.0
searchBr
.
cornerRadius
=
35
/
2.0
searchBr
.
delegate
=
self
searchBr
.
delegateL
=
self
AMapServices
.
shared
()
.
apiKey
=
"ca417b43e3d031db9c29382cc09a174a"
AMapServices
.
shared
()
.
apiKey
=
"ca417b43e3d031db9c29382cc09a174a"
manger
.
delegate
=
self
manger
.
delegate
=
self
manger
.
startUpdatingLocation
()
manger
.
startUpdatingLocation
()
}
}
func
locationManager
(
_
manager
:
CLLocationManager
,
didUpdateLocations
locations
:
[
CLLocation
])
{
manger
.
stopUpdatingLocation
()
let
location
=
locations
.
last
lat
=
location
?
.
coordinate
.
latitude
as!
CLLocationDegrees
lng
=
location
?
.
coordinate
.
longitude
as!
CLLocationDegrees
initMapView
(
lat
:
lat
,
lng
:
lng
)
initSearch
()
}
func
initMapView
(
lat
:
CLLocationDegrees
,
lng
:
CLLocationDegrees
)
{
func
initMapView
(
lat
:
CLLocationDegrees
,
lng
:
CLLocationDegrees
)
{
AMapServices
.
shared
()
.
enableHTTPS
=
true
AMapServices
.
shared
()
.
enableHTTPS
=
true
...
@@ -98,6 +137,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -98,6 +137,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
var
introView
:
UIView
?
var
introView
:
UIView
?
var
titleLbl
:
UILabel
?
var
titleLbl
:
UILabel
?
var
contentLbl
:
UILabel
?
var
contentLbl
:
UILabel
?
var
adrArr
:
Array
<
AMapPOI
>
=
[]
func
onPOISearchDone
(
_
request
:
AMapPOISearchBaseRequest
!
,
response
:
AMapPOISearchResponse
!
)
{
func
onPOISearchDone
(
_
request
:
AMapPOISearchBaseRequest
!
,
response
:
AMapPOISearchResponse
!
)
{
...
@@ -105,6 +145,12 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -105,6 +145,12 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
return
return
}
}
//解析response获取POI信息,具体解析见 Demo
//解析response获取POI信息,具体解析见 Demo
adrArr
.
removeAll
()
response
.
pois
.
forEach
{
(
poi
)
in
adrArr
.
append
(
poi
)
}
print
(
adrArr
.
count
)
if
introView
==
nil
{
if
introView
==
nil
{
introView
=
UIView
()
introView
=
UIView
()
...
@@ -125,11 +171,21 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -125,11 +171,21 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
introView
?
.
addSubview
(
contentLbl
!
)
introView
?
.
addSubview
(
contentLbl
!
)
}
}
titleLbl
!.
text
=
response
.
pois
.
first
?
.
name
titleLbl
!.
text
=
response
.
pois
.
first
?
.
name
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
paraph
=
NSMutableParagraphStyle
()
//将行间距设置为28
paraph
.
lineSpacing
=
3
let
str
=
"
\(
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
attributes
=
[
NSAttributedString
.
Key
.
font
:
UIFont
.
systemFont
(
ofSize
:
11
),
NSAttributedString
.
Key
.
paragraphStyle
:
paraph
]
contentLbl
!.
attributedText
=
NSAttributedString
(
string
:
str
,
attributes
:
attributes
)
let
t
=
getStrHeight
(
str
:
titleLbl
!.
text
!
,
fontSize
:
13
)
let
t
=
getStrHeight
(
str
:
titleLbl
!.
text
!
,
fontSize
:
13
)
let
c
=
getStrHeight
(
str
:
contentLbl
!.
text
!
,
fontSize
:
11
)
let
c
=
getStrHeight
(
str
:
str
,
fontSize
:
11
)
let
h
=
t
+
c
let
h
=
t
+
c
titleLbl
?
.
snp_updateConstraints
({
(
make
)
in
titleLbl
?
.
snp_updateConstraints
({
(
make
)
in
...
@@ -138,9 +194,9 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -138,9 +194,9 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
make
.
right
.
equalTo
(
-
10
)
make
.
right
.
equalTo
(
-
10
)
make
.
height
.
equalTo
(
t
)
make
.
height
.
equalTo
(
t
)
})
})
contentLbl
?
.
snp_updateConstraints
({
(
make
)
in
contentLbl
?
.
snp_updateConstraints
({
(
make
)
in
make
.
top
.
equalTo
(
titleLbl
!.
snp
.
bottom
)
.
offset
(
5
)
make
.
top
.
equalTo
(
titleLbl
!.
snp
_
bottom
)
.
offset
(
5
)
make
.
left
.
equalTo
(
10
)
make
.
left
.
equalTo
(
10
)
make
.
right
.
equalTo
(
-
10
)
make
.
right
.
equalTo
(
-
10
)
make
.
height
.
equalTo
(
c
)
make
.
height
.
equalTo
(
c
)
...
@@ -174,7 +230,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -174,7 +230,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
})
})
}
}
func
getStrHeight
(
str
:
String
,
fontSize
:
CGFloat
)
->
CGFloat
{
func
getStrHeight
(
str
:
String
,
fontSize
:
CGFloat
)
->
CGFloat
{
let
lbl
=
UILabel
()
let
lbl
=
UILabel
()
lbl
.
text
=
str
lbl
.
text
=
str
...
@@ -246,5 +302,28 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
...
@@ -246,5 +302,28 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
let
bdlat
=
z
*
sin
(
theta
)
+
0.006
let
bdlat
=
z
*
sin
(
theta
)
+
0.006
return
(
bdlat
,
bdlon
)
return
(
bdlat
,
bdlon
)
}
}
func
clearSearchAction
()
{
print
(
"清楚搜索文字"
)
}
func
searchBarSearchButtonClicked
(
_
searchBar
:
UISearchBar
)
{
print
(
"点击搜索进行--"
)
searchBar
.
resignFirstResponder
()
let
request
=
AMapPOIKeywordsSearchRequest
()
request
.
keywords
=
searchBar
.
text
request
.
requireExtension
=
true
request
.
cityLimit
=
true
request
.
requireSubPOIs
=
true
search
.
aMapPOIKeywordsSearch
(
request
)
}
func
searchBarShouldBeginEditing
(
_
searchBar
:
UISearchBar
)
->
Bool
{
print
(
"调起搜索后添加个蒙版本"
)
closeBtn
.
isHidden
=
false
listViewBG
.
isHidden
=
false
return
true
}
}
}
GeliBusinessPlatform/ViewController/货拉拉/收发货地址/ToAndFormSelectViewController.xib
View file @
e3c17213
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment