Updates GamesDatabaseBrowserViewController design to match Delta dark theme
This commit is contained in:
parent
45c18cc8e2
commit
eebb593aa2
@ -94,6 +94,7 @@
|
||||
BFEC732D1AAECC4A00650035 /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFEC732C1AAECC4A00650035 /* Roxas.framework */; };
|
||||
BFEC732E1AAECC4A00650035 /* Roxas.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BFEC732C1AAECC4A00650035 /* Roxas.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
BFF93AA01E0FB036005EC865 /* InputStreamOutputWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF93A9F1E0FB036005EC865 /* InputStreamOutputWriter.swift */; };
|
||||
BFFA4C091E8A24D600D87934 /* GameMetadataTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFFA4C081E8A24D600D87934 /* GameMetadataTableViewCell.swift */; };
|
||||
BFFA71DD1AAC406100EE9DD1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFFA71DC1AAC406100EE9DD1 /* AppDelegate.swift */; };
|
||||
BFFA71E21AAC406100EE9DD1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BFFA71E01AAC406100EE9DD1 /* Main.storyboard */; };
|
||||
BFFC461E1D59823500AF2CC6 /* GamesPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFFC461B1D59823500AF2CC6 /* GamesPresentationController.swift */; };
|
||||
@ -199,6 +200,7 @@
|
||||
BFE4269D1D9C68E600DC913F /* SaveStatesStoryboardSegue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SaveStatesStoryboardSegue.swift; path = Segues/SaveStatesStoryboardSegue.swift; sourceTree = "<group>"; };
|
||||
BFEC732C1AAECC4A00650035 /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BFF93A9F1E0FB036005EC865 /* InputStreamOutputWriter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InputStreamOutputWriter.swift; path = Components/Importing/InputStreamOutputWriter.swift; sourceTree = "<group>"; };
|
||||
BFFA4C081E8A24D600D87934 /* GameMetadataTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameMetadataTableViewCell.swift; path = Database/OpenVGDB/GameMetadataTableViewCell.swift; sourceTree = "<group>"; };
|
||||
BFFA71D71AAC406100EE9DD1 /* Delta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Delta.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BFFA71DB1AAC406100EE9DD1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
BFFA71DC1AAC406100EE9DD1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
@ -423,6 +425,7 @@
|
||||
BF59426E1E09BC5D0051894B /* GamesDatabase.swift */,
|
||||
BF95E2761E4977BF0030E7AD /* GameMetadata.swift */,
|
||||
BF95E2781E4982A10030E7AD /* GamesDatabaseBrowserViewController.swift */,
|
||||
BFFA4C081E8A24D600D87934 /* GameMetadataTableViewCell.swift */,
|
||||
);
|
||||
name = OpenVGDB;
|
||||
sourceTree = "<group>";
|
||||
@ -740,6 +743,7 @@
|
||||
BF5942891E09BC8B0051894B /* _GameCollection.swift in Sources */,
|
||||
BF34FA111CF1899D006624C7 /* CheatTextView.swift in Sources */,
|
||||
BF1DAD5D1D9F576000E752A7 /* GameTypeControllerSkinsViewController.swift in Sources */,
|
||||
BFFA4C091E8A24D600D87934 /* GameMetadataTableViewCell.swift in Sources */,
|
||||
BFFC46231D5984A000AF2CC6 /* LaunchViewController.swift in Sources */,
|
||||
BF5942701E09BC5D0051894B /* GamesDatabase.swift in Sources */,
|
||||
BF34FA071CF0F510006624C7 /* EditCheatViewController.swift in Sources */,
|
||||
|
||||
@ -24,7 +24,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate
|
||||
Delta.register(SNES.core)
|
||||
Delta.register(GBA.core)
|
||||
|
||||
self.window?.tintColor = UIColor.deltaPurple
|
||||
self.configureAppearance()
|
||||
|
||||
// Disable system gestures that delay touches on left edge of screen
|
||||
for gestureRecognizer in self.window?.gestureRecognizers ?? [] where NSStringFromClass(type(of: gestureRecognizer)).contains("GateGesture")
|
||||
@ -71,6 +71,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate
|
||||
}
|
||||
}
|
||||
|
||||
extension AppDelegate
|
||||
{
|
||||
func configureAppearance()
|
||||
{
|
||||
self.window?.tintColor = UIColor.deltaPurple
|
||||
|
||||
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes[NSForegroundColorAttributeName] = UIColor.white
|
||||
}
|
||||
}
|
||||
|
||||
extension AppDelegate
|
||||
{
|
||||
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -60,27 +61,54 @@
|
||||
<scene sceneID="S7I-gw-igt">
|
||||
<objects>
|
||||
<tableViewController id="SB6-jW-dhZ" customClass="GamesDatabaseBrowserViewController" customModule="Delta" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="bJf-Sa-ZOX">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="97" sectionHeaderHeight="28" sectionFooterHeight="28" id="bJf-Sa-ZOX">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="aZq-iY-vhF" style="IBUITableViewCellStyleDefault" id="4cJ-4B-Kgt">
|
||||
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" id="4cJ-4B-Kgt" customClass="GameMetadataTableViewCell" customModule="Delta" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="28" width="375" height="97"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4cJ-4B-Kgt" id="7ze-s0-mpI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="96"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="aZq-iY-vhF">
|
||||
<rect key="frame" x="15" y="0.0" width="345" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DSH-Hk-snb" userLabel="Selected Background View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="97"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BoxArt" translatesAutoresizingMaskIntoConstraints="NO" id="tNY-2F-llo">
|
||||
<rect key="frame" x="15" y="8" width="80" height="80"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="tNY-2F-llo" secondAttribute="height" multiplier="1:1" id="f4E-bV-L96"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Super Mario World" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DND-Fv-FyB">
|
||||
<rect key="frame" x="110" y="38.5" width="250" height="20.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="DND-Fv-FyB" firstAttribute="leading" secondItem="tNY-2F-llo" secondAttribute="trailing" constant="15" id="71e-t3-7Av"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="DND-Fv-FyB" secondAttribute="bottom" constant="1" id="9No-RE-0xx"/>
|
||||
<constraint firstItem="DND-Fv-FyB" firstAttribute="top" relation="greaterThanOrEqual" secondItem="7ze-s0-mpI" secondAttribute="top" constant="1" id="F9q-6H-sqC"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DND-Fv-FyB" secondAttribute="trailing" constant="15" id="KFv-7n-LrD"/>
|
||||
<constraint firstItem="DND-Fv-FyB" firstAttribute="centerY" secondItem="7ze-s0-mpI" secondAttribute="centerY" id="YBX-t4-jkR"/>
|
||||
<constraint firstItem="tNY-2F-llo" firstAttribute="top" secondItem="7ze-s0-mpI" secondAttribute="top" constant="8" id="bYX-gA-QvB"/>
|
||||
<constraint firstAttribute="bottom" secondItem="tNY-2F-llo" secondAttribute="bottom" constant="8" id="fxr-wr-I6X"/>
|
||||
<constraint firstItem="tNY-2F-llo" firstAttribute="leading" secondItem="7ze-s0-mpI" secondAttribute="leading" constant="15" id="hX2-Gr-Bnz"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="artworkImageView" destination="tNY-2F-llo" id="GqY-jv-rso"/>
|
||||
<outlet property="artworkImageViewLeadingConstraint" destination="hX2-Gr-Bnz" id="be8-dr-c8K"/>
|
||||
<outlet property="artworkImageViewTrailingConstraint" destination="71e-t3-7Av" id="y62-KO-y1r"/>
|
||||
<outlet property="nameLabel" destination="DND-Fv-FyB" id="LhN-cA-8Hy"/>
|
||||
<outlet property="selectedBackgroundView" destination="DSH-Hk-snb" id="hLY-4k-VxU"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
@ -99,7 +127,7 @@
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="f3a-hX-Qnu" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="mUU-ug-yNs" userLabel="Exit" sceneMemberID="exit"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2652" y="1002"/>
|
||||
<point key="canvasLocation" x="2652" y="1001.649175412294"/>
|
||||
</scene>
|
||||
<!--Game Collection View Controller-->
|
||||
<scene sceneID="qNA-NP-TiF">
|
||||
@ -291,7 +319,7 @@
|
||||
<objects>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="6bq-zy-UZU" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="uzY-vR-coL">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" barStyle="black" id="uzY-vR-coL">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
@ -306,6 +334,7 @@
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="BoxArt" width="100" height="100"/>
|
||||
<image name="Settings_Button" width="22" height="22"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
|
||||
31
Delta/Database/OpenVGDB/GameMetadataTableViewCell.swift
Normal file
31
Delta/Database/OpenVGDB/GameMetadataTableViewCell.swift
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// GameMetadataTableViewCell.swift
|
||||
// Delta
|
||||
//
|
||||
// Created by Riley Testut on 3/27/17.
|
||||
// Copyright © 2017 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class GameMetadataTableViewCell: UITableViewCell
|
||||
{
|
||||
@IBOutlet private(set) var nameLabel: UILabel!
|
||||
@IBOutlet private(set) var artworkImageView: UIImageView!
|
||||
|
||||
@IBOutlet private(set) var artworkImageViewLeadingConstraint: NSLayoutConstraint!
|
||||
@IBOutlet private(set) var artworkImageViewTrailingConstraint: NSLayoutConstraint!
|
||||
|
||||
override func awakeFromNib()
|
||||
{
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
override func setSelected(_ selected: Bool, animated: Bool)
|
||||
{
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,8 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import AVFoundation
|
||||
|
||||
import Roxas
|
||||
|
||||
class GamesDatabaseBrowserViewController: UITableViewController
|
||||
@ -37,17 +39,17 @@ class GamesDatabaseBrowserViewController: UITableViewController
|
||||
|
||||
self.dataSource = RSTArrayTableViewDataSource<GameMetadata>(items: [])
|
||||
|
||||
let titleText = NSLocalizedString("Games Database", comment: "")
|
||||
let detailText = NSLocalizedString("To search the database, type the name of a game in the search bar.", comment: "")
|
||||
|
||||
let placeholderView = RSTBackgroundView()
|
||||
placeholderView.textLabel.text = titleText
|
||||
placeholderView.detailTextLabel.text = detailText
|
||||
placeholderView.textLabel.textColor = UIColor.lightText
|
||||
placeholderView.detailTextLabel.textColor = UIColor.lightText
|
||||
|
||||
self.dataSource.placeholderView = placeholderView
|
||||
|
||||
super.init(coder: aDecoder)
|
||||
|
||||
self.dataSource.cellConfigurationHandler = self.configure(cell:with:for:)
|
||||
self.dataSource.cellConfigurationHandler = { (cell, metadata, indexPath) in
|
||||
self.configure(cell: cell as! GameMetadataTableViewCell, with: metadata, for: indexPath)
|
||||
}
|
||||
|
||||
if let database = self.database
|
||||
{
|
||||
@ -60,19 +62,8 @@ class GamesDatabaseBrowserViewController: UITableViewController
|
||||
|
||||
dataSource.items = results
|
||||
|
||||
if searchValue.text == ""
|
||||
{
|
||||
rst_dispatch_sync_on_main_thread {
|
||||
placeholderView.textLabel.text = titleText
|
||||
placeholderView.detailTextLabel.text = detailText
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rst_dispatch_sync_on_main_thread {
|
||||
placeholderView.textLabel.text = NSLocalizedString("No Games Found", comment: "")
|
||||
placeholderView.detailTextLabel.text = NSLocalizedString("Please make sure the name is correct, or try searching for another game.", comment: "")
|
||||
}
|
||||
rst_dispatch_sync_on_main_thread {
|
||||
self.updatePlaceholderView()
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -81,27 +72,46 @@ class GamesDatabaseBrowserViewController: UITableViewController
|
||||
self.definesPresentationContext = true
|
||||
}
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
return .lightContent
|
||||
}
|
||||
|
||||
override func viewDidLoad()
|
||||
{
|
||||
super.viewDidLoad()
|
||||
|
||||
self.view.backgroundColor = UIColor.deltaDarkGray
|
||||
|
||||
self.tableView.dataSource = self.dataSource
|
||||
self.tableView.indicatorStyle = .white
|
||||
self.tableView.separatorColor = UIColor.gray
|
||||
|
||||
self.dataSource.searchController.delegate = self
|
||||
self.dataSource.searchController.searchBar.barStyle = .blackTranslucent
|
||||
self.tableView.tableHeaderView = self.dataSource.searchController.searchBar
|
||||
self.tableView.rowHeight = 64
|
||||
|
||||
self.updatePlaceholderView()
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning()
|
||||
{
|
||||
super.didReceiveMemoryWarning()
|
||||
}
|
||||
|
||||
func configure(cell: UITableViewCell, with metadata: GameMetadata, for indexPath: IndexPath)
|
||||
}
|
||||
|
||||
extension GamesDatabaseBrowserViewController
|
||||
{
|
||||
func configure(cell: GameMetadataTableViewCell, with metadata: GameMetadata, for indexPath: IndexPath)
|
||||
{
|
||||
cell.textLabel?.text = metadata.name ?? NSLocalizedString("Unknown", comment: "")
|
||||
cell.textLabel?.numberOfLines = 2
|
||||
cell.backgroundColor = UIColor.deltaDarkGray
|
||||
|
||||
cell.imageView?.image = #imageLiteral(resourceName: "BoxArt")
|
||||
cell.imageView?.contentMode = .scaleAspectFit
|
||||
cell.nameLabel.text = metadata.name ?? NSLocalizedString("Unknown", comment: "")
|
||||
cell.artworkImageView.image = #imageLiteral(resourceName: "BoxArt")
|
||||
|
||||
cell.artworkImageViewLeadingConstraint.constant = 15
|
||||
cell.artworkImageViewTrailingConstraint.constant = 15
|
||||
|
||||
cell.separatorInset.left = cell.nameLabel.frame.minX
|
||||
|
||||
if let artworkURL = metadata.artworkURL
|
||||
{
|
||||
@ -110,9 +120,16 @@ class GamesDatabaseBrowserViewController: UITableViewController
|
||||
operation.resultHandler = { (image, error) in
|
||||
if let image = image
|
||||
{
|
||||
let artworkDisplaySize = AVMakeRect(aspectRatio: image.size, insideRect: cell.artworkImageView.bounds)
|
||||
let offset = (cell.artworkImageView.bounds.width - artworkDisplaySize.width) / 2
|
||||
|
||||
DispatchQueue.main.async {
|
||||
cell.imageView?.image = image
|
||||
cell.imageView?.superview?.layoutIfNeeded()
|
||||
// Offset artworkImageViewLeadingConstraint and artworkImageViewTrailingConstraint to right-align artworkImageView
|
||||
cell.artworkImageViewLeadingConstraint.constant += offset
|
||||
cell.artworkImageViewTrailingConstraint.constant -= offset
|
||||
|
||||
cell.artworkImageView.image = image
|
||||
cell.artworkImageView.superview?.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -120,6 +137,22 @@ class GamesDatabaseBrowserViewController: UITableViewController
|
||||
self.operationQueue.addOperation(operation, forKey: indexPath as NSIndexPath)
|
||||
}
|
||||
}
|
||||
|
||||
func updatePlaceholderView()
|
||||
{
|
||||
guard let placeholderView = self.dataSource.placeholderView as? RSTBackgroundView else { return }
|
||||
|
||||
if self.dataSource.searchController.searchBar.text == ""
|
||||
{
|
||||
placeholderView.textLabel.text = NSLocalizedString("Games Database", comment: "")
|
||||
placeholderView.detailTextLabel.text = NSLocalizedString("To search the database, type the name of a game in the search bar.", comment: "")
|
||||
}
|
||||
else
|
||||
{
|
||||
placeholderView.textLabel.text = NSLocalizedString("No Games Found", comment: "")
|
||||
placeholderView.detailTextLabel.text = NSLocalizedString("Please make sure the name is correct, or try searching for another game.", comment: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension GamesDatabaseBrowserViewController
|
||||
@ -141,3 +174,26 @@ extension GamesDatabaseBrowserViewController
|
||||
operation?.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
extension GamesDatabaseBrowserViewController: UISearchControllerDelegate
|
||||
{
|
||||
func didPresentSearchController(_ searchController: UISearchController)
|
||||
{
|
||||
// Fix incorrect table view scroll indicator insets
|
||||
self.tableView.scrollIndicatorInsets.top = self.navigationController!.navigationBar.bounds.height + UIApplication.shared.statusBarFrame.height
|
||||
}
|
||||
|
||||
func willDismissSearchController(_ searchController: UISearchController)
|
||||
{
|
||||
// Manually set items to empty array to prevent crash if user dismissses searchController while scrolling
|
||||
self.dataSource.items = []
|
||||
self.updatePlaceholderView()
|
||||
}
|
||||
|
||||
func didDismissSearchController(_ searchController: UISearchController)
|
||||
{
|
||||
// Fix potentially incorrect offset if user dismisses searchController while scrolling
|
||||
self.tableView.setContentOffset(CGPoint.zero, animated: false)
|
||||
self.tableView.setContentOffset(CGPoint(x: 0, y: -self.topLayoutGuide.length), animated: false)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user