From 5ffc6e1cef55ac3222957b6bccd837de3e94049d Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 18 Apr 2019 08:33:39 -0500 Subject: [PATCH] Changed to automatically hide the master list when on iPad in portrait. --- NetNewsWire.xcodeproj/project.pbxproj | 4 ++++ .../UISplitViewController-Extensions.swift | 14 ++++++++++++++ iOS/Timeline/MasterTimelineViewController.swift | 1 + 3 files changed, 19 insertions(+) create mode 100644 iOS/Extensions/UISplitViewController-Extensions.swift diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index a56c9ea38..1e69ba21f 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 512E08E62268800D00BDCFDD /* FolderTreeControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97A11ED9F180007D329B /* FolderTreeControllerDelegate.swift */; }; 512E08E72268801200BDCFDD /* FeedTreeControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97611ED9EB96007D329B /* FeedTreeControllerDelegate.swift */; }; 512E09012268907400BDCFDD /* MasterTableViewSectionHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512E08F722688F7C00BDCFDD /* MasterTableViewSectionHeader.swift */; }; + 512E09352268B25900BDCFDD /* UISplitViewController-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */; }; 517D9075226639F500323654 /* AddAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517D906B2266392900323654 /* AddAccountViewController.swift */; }; 519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519B8D322143397200FA689C /* SharingServiceDelegate.swift */; }; 51C451A9226377C200C03939 /* ArticlesDatabase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8407167F2262A61100344432 /* ArticlesDatabase.framework */; }; @@ -603,6 +604,7 @@ 5127B236222B4849006D641D /* DetailKeyboardDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailKeyboardDelegate.swift; sourceTree = ""; }; 5127B237222B4849006D641D /* DetailKeyboardShortcuts.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = DetailKeyboardShortcuts.plist; sourceTree = ""; }; 512E08F722688F7C00BDCFDD /* MasterTableViewSectionHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTableViewSectionHeader.swift; sourceTree = ""; }; + 512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISplitViewController-Extensions.swift"; sourceTree = ""; }; 517D906B2266392900323654 /* AddAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountViewController.swift; sourceTree = ""; }; 519B8D322143397200FA689C /* SharingServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingServiceDelegate.swift; sourceTree = ""; }; 51C4524E226506F400C03939 /* UIStoryboard-Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIStoryboard-Extensions.swift"; sourceTree = ""; }; @@ -902,6 +904,7 @@ 51C45250226506F400C03939 /* String-Extensions.swift */, 51C4524F226506F400C03939 /* UIImage-Extensions.swift */, 51C4524E226506F400C03939 /* UIStoryboard-Extensions.swift */, + 512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */, ); path = Extensions; sourceTree = ""; @@ -2145,6 +2148,7 @@ 51C4525A226508D600C03939 /* UIStoryboard-Extensions.swift in Sources */, 51C452A622650A3500C03939 /* Node-Extensions.swift in Sources */, 51C45294226509C800C03939 /* SearchFeedDelegate.swift in Sources */, + 512E09352268B25900BDCFDD /* UISplitViewController-Extensions.swift in Sources */, 51C452A022650A1900C03939 /* FeedIconDownloader.swift in Sources */, 517D9075226639F500323654 /* AddAccountViewController.swift in Sources */, 51C4529E22650A1900C03939 /* ImageDownloader.swift in Sources */, diff --git a/iOS/Extensions/UISplitViewController-Extensions.swift b/iOS/Extensions/UISplitViewController-Extensions.swift new file mode 100644 index 000000000..617b417eb --- /dev/null +++ b/iOS/Extensions/UISplitViewController-Extensions.swift @@ -0,0 +1,14 @@ +//Copyright © 2019 Ranchero Software. All rights reserved. + +import UIKit + +extension UISplitViewController { + + func toggleMasterView() { + let barButtonItem = self.displayModeButtonItem + if let action = barButtonItem.action { + UIApplication.shared.sendAction(action, to: barButtonItem.target, from: nil, for: nil) + } + } + +} diff --git a/iOS/Timeline/MasterTimelineViewController.swift b/iOS/Timeline/MasterTimelineViewController.swift index e4e37e3ca..e3eb4d4ff 100644 --- a/iOS/Timeline/MasterTimelineViewController.swift +++ b/iOS/Timeline/MasterTimelineViewController.swift @@ -132,6 +132,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner controller.article = article controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem controller.navigationItem.leftItemsSupplementBackButton = true + splitViewController?.toggleMasterView() } } }