Skip to content

Commit

Permalink
add workaround for iOS 13 searchBar issue, fixes #60
Browse files Browse the repository at this point in the history
  • Loading branch information
weakfl committed Oct 15, 2019
1 parent 907f514 commit 8911a15
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
30 changes: 17 additions & 13 deletions Demo/LocationPickerDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="OVO-fv-odN">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="OVO-fv-odN">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -13,33 +16,33 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="No location selected" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eSf-PL-I4v">
<rect key="frame" x="30" y="289" width="540" height="21"/>
<rect key="frame" x="30" y="313" width="315" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="FZk-RA-1hh"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O0b-J7-Fm9">
<rect key="frame" x="244" y="192" width="112" height="30"/>
<rect key="frame" x="131.66666666666666" y="216" width="112" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="112" id="p7B-kX-Itn"/>
<constraint firstAttribute="height" constant="30" id="sux-pw-51R"/>
</constraints>
<state key="normal" title="Choose location">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<segue destination="6yk-tj-9ye" kind="show" identifier="LocationPicker" id="rMn-FB-8eo"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="eSf-PL-I4v" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="30" id="TMv-2m-QF0"/>
<constraint firstItem="O0b-J7-Fm9" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="128" id="boV-HZ-fBh"/>
Expand All @@ -66,9 +69,9 @@
<viewControllerLayoutGuide type="bottom" id="zgc-bj-AVo"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="y9p-Ca-sjb">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Oi0-sC-0Cy" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand All @@ -81,8 +84,9 @@
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="OVO-fv-odN" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="pws-m2-afo">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<rect key="frame" x="0.0" y="44" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
Expand All @@ -94,5 +98,5 @@
<point key="canvasLocation" x="255" y="306"/>
</scene>
</scenes>
<color key="tintColor" red="0.86274509799999999" green="0.31372549020000001" blue="0.17254901959999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="tintColor" red="0.86274509799999999" green="0.31372549020000001" blue="0.17254901959999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</document>
7 changes: 7 additions & 0 deletions LocationPicker/LocationPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ open class LocationPickerViewController: UIViewController {

open override func viewDidLoad() {
super.viewDidLoad()

if #available(iOS 13.0, *), let navigationController = navigationController {
let appearance = navigationController.navigationBar.standardAppearance
appearance.backgroundColor = navigationController.navigationBar.barTintColor
navigationItem.standardAppearance = appearance
navigationItem.scrollEdgeAppearance = appearance
}

locationManager.delegate = self
mapView.delegate = self
Expand Down

0 comments on commit 8911a15

Please sign in to comment.