Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #793 from Esri/release/100.6
Browse files Browse the repository at this point in the history
Release 100.6
  • Loading branch information
philium authored Oct 22, 2019
2 parents 4dc21a7 + e9752e8 commit e9c6c08
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ class SearchForWebmapByKeywordViewController: UICollectionViewController {

// register to be notified about authentication challenges
AGSAuthenticationManager.shared().delegate = self

// create the portal
portal = AGSPortal(url: URL(string: "https://arcgis.com")!, loginRequired: false)

(navigationItem.rightBarButtonItem as! SourceCodeBarButtonItem).filenames = ["SearchForWebmapByKeywordViewController", "WebMapCell", "WebMapViewController"]

if #available(iOS 13, *) {
// for iOS 13 this must be added in viewDidLoad
// for iOS 12, it gets added in viewDidAppear, because for iOS 12 it doesn't
// show up if added here.
addSearchController()
}
}

override func viewDidAppear(_ animated: Bool) {
Expand All @@ -50,36 +57,49 @@ class SearchForWebmapByKeywordViewController: UICollectionViewController {
// create the search controller
let searchController = UISearchController(searchResultsController: nil)
searchController.obscuresBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false
// Setting hidesNavigationBarDuringPresentation to false causes issues on iOS 13 - 13.1.2,
// so we hide the navigation bar during search.
searchController.hidesNavigationBarDuringPresentation = true
// send search query updates to the results controller
searchController.searchResultsUpdater = self

let searchBar = searchController.searchBar
searchBar.autocapitalizationType = .none
// set the color of "Cancel" text
searchBar.tintColor = .white

if #available(iOS 13, *) {
// Do nothing, on iOS 13 the settings below have no effect.
} else {
// This code is required to make the search bar look decent on iOS 12
// This does not work on iOS 13, where the search bar looks different.
// Different meaning - not as good as iOS 12 looks like with this fix,
// but at least acceptable and a bit better than what it would look like
// on 12 without this fix.
// set the color of "Cancel" text
searchBar.tintColor = .white

// find the text field to customize its appearance
if let textfield = searchBar.value(forKey: "searchField") as? UITextField {
// set the color of the insertion cursor
textfield.tintColor = UIColor.darkText
if let backgroundview = textfield.subviews.first {
backgroundview.backgroundColor = UIColor.white
backgroundview.layer.cornerRadius = 12
backgroundview.clipsToBounds = true
}
}
}

// embed the search bar under the title in the navigation bar
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
// find the text field to customize its appearance
if let textfield = searchBar.value(forKey: "searchField") as? UITextField {
// set the color of the insertion cursor
textfield.tintColor = UIColor.darkText
if let backgroundview = textfield.subviews.first {
backgroundview.backgroundColor = UIColor.white
backgroundview.layer.cornerRadius = 12
backgroundview.clipsToBounds = true
}
}
}

let dateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateStyle = .medium
return formatter
}()

private func startWebMapSearch(query: String) {
// if the last search hasn't returned yet, cancel it
lastQueryCancelable?.cancel()
Expand Down Expand Up @@ -108,7 +128,7 @@ class SearchForWebmapByKeywordViewController: UICollectionViewController {
}
}
}

// MARK: - Navigation

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,41 @@ class ContentCollectionViewController: UICollectionViewController, UICollectionV
// create the search controller
let searchController = UISearchController(searchResultsController: searchResultsController)
searchController.obscuresBackgroundDuringPresentation = true
searchController.hidesNavigationBarDuringPresentation = false
// Setting hidesNavigationBarDuringPresentation to false causes issues on iOS 13 - 13.1.2,
// so we hide the navigation bar during search.
searchController.hidesNavigationBarDuringPresentation = true
// send search query updates to the results controller
searchController.searchResultsUpdater = searchResultsController

let searchBar = searchController.searchBar
searchBar.autocapitalizationType = .none
// set the color of "Cancel" text
searchBar.tintColor = .white

// embed the search bar under the title in the navigation bar
navigationItem.searchController = searchController

// find the text field to customize its appearance
if let textfield = searchBar.value(forKey: "searchField") as? UITextField {
// set the color of the insertion cursor
textfield.tintColor = UIColor.darkText
if let backgroundview = textfield.subviews.first {
backgroundview.backgroundColor = UIColor.white
backgroundview.layer.cornerRadius = 12
backgroundview.clipsToBounds = true
if #available(iOS 13, *) {
// Do nothing, on iOS 13 the settings below have no effect.
} else {
// This code is required to make the search bar look decent on iOS 12
// This does not work on iOS 13, where the search bar looks different.
// Different meaning - not as good as iOS 12 looks like with this fix,
// but at least acceptable and a bit better than what it would look like
// on 12 without this fix.

// set the color of "Cancel" text
searchBar.tintColor = .white

// find the text field to customize its appearance
if let textfield = searchBar.value(forKey: "searchField") as? UITextField {
// set the color of the insertion cursor
textfield.tintColor = UIColor.darkText
if let backgroundview = textfield.subviews.first {
backgroundview.backgroundColor = UIColor.white
backgroundview.layer.cornerRadius = 12
backgroundview.clipsToBounds = true
}
}
}

// embed the search bar under the title in the navigation bar
navigationItem.searchController = searchController
}

// MARK: UICollectionViewDataSource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oI0-pg-r9z">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oI0-pg-r9z">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Open Scene View Controller-->
<scene sceneID="qMc-Za-MJD">
<objects>
<viewController id="oI0-pg-r9z" customClass="OpenSceneViewController" customModule="arcgis_ios_sdk_samples" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="oI0-pg-r9z" customClass="OpenSceneViewController" customModule="ArcGIS_Runtime_SDK_Samples" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Wvg-jB-teh">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ryt-GZ-85l" customClass="AGSSceneView">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="jRW-g3-mXx" firstAttribute="trailing" secondItem="ryt-GZ-85l" secondAttribute="trailing" id="BgQ-MV-9tu"/>
<constraint firstAttribute="trailing" secondItem="ryt-GZ-85l" secondAttribute="trailing" id="BgQ-MV-9tu"/>
<constraint firstItem="ryt-GZ-85l" firstAttribute="top" secondItem="jRW-g3-mXx" secondAttribute="top" id="JNq-wS-0zt"/>
<constraint firstAttribute="bottom" secondItem="ryt-GZ-85l" secondAttribute="bottom" id="VgJ-5E-mY1"/>
<constraint firstItem="ryt-GZ-85l" firstAttribute="leading" secondItem="jRW-g3-mXx" secondAttribute="leading" id="qyt-Hr-y87"/>
<constraint firstItem="ryt-GZ-85l" firstAttribute="leading" secondItem="Wvg-jB-teh" secondAttribute="leading" id="qyt-Hr-y87"/>
</constraints>
<viewLayoutGuide key="safeArea" id="jRW-g3-mXx"/>
</view>
Expand Down

0 comments on commit e9c6c08

Please sign in to comment.