From f1a016d0ee49049313677499f78608ecfebb77c2 Mon Sep 17 00:00:00 2001 From: "liangmingzou@163.com" Date: Tue, 10 Oct 2017 11:26:28 +0800 Subject: [PATCH] Fix more button bug --- PhotoBrowser/PBCustomView.swift | 5 +++++ PhotoBrowser/PhotoBrowser.swift | 6 ++++++ PhotoBrowserDemo.xcodeproj/project.pbxproj | 6 ++---- PhotoBrowserDemo/ViewController.swift | 5 ++++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/PhotoBrowser/PBCustomView.swift b/PhotoBrowser/PBCustomView.swift index 4654802..3c09563 100644 --- a/PhotoBrowser/PBCustomView.swift +++ b/PhotoBrowser/PBCustomView.swift @@ -95,6 +95,11 @@ class PBNavigationBar: UIView { } } } + var isShowMoreButton: Bool = true { + didSet { + self.updateMoreButtonStatus(!isShowMoreButton) + } + } lazy var contentView: UIView = { let view = UIView() diff --git a/PhotoBrowser/PhotoBrowser.swift b/PhotoBrowser/PhotoBrowser.swift index 0bc793b..d7c2af6 100644 --- a/PhotoBrowser/PhotoBrowser.swift +++ b/PhotoBrowser/PhotoBrowser.swift @@ -122,6 +122,11 @@ open class PhotoBrowser: UIPageViewController { } } + open var isShowMoreButton: Bool = true { + didSet { + headerView?.isShowMoreButton = isShowMoreButton + } + } open var isFromPhotoPicker: Bool = false open var isPreviewMode: Bool = false open var selectedIndex: [Int] = [] @@ -238,6 +243,7 @@ extension PhotoBrowser { if let headerView = headerView { headerView.isFromPhotoPicker = isFromPhotoPicker headerView.isPreviewMode = isPreviewMode + headerView.isShowMoreButton = isShowMoreButton headerView.alpha = 0 view.addSubview(headerView) headerView.translatesAutoresizingMaskIntoConstraints = false diff --git a/PhotoBrowserDemo.xcodeproj/project.pbxproj b/PhotoBrowserDemo.xcodeproj/project.pbxproj index ad4e8aa..2595070 100644 --- a/PhotoBrowserDemo.xcodeproj/project.pbxproj +++ b/PhotoBrowserDemo.xcodeproj/project.pbxproj @@ -13,7 +13,7 @@ 4A52D2131C72D13B001C257B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4A52D2121C72D13B001C257B /* Assets.xcassets */; }; 4A52D2161C72D13B001C257B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4A52D2141C72D13B001C257B /* LaunchScreen.storyboard */; }; 4A8EB7231CEF068D0065EAB0 /* Kingfisher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A6BC7BB1C770DE100DACDA5 /* Kingfisher.framework */; }; - 86AEF72E1EDEB9D100034DBA /* PhotoBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86AEF72D1EDEB9D100034DBA /* PhotoBrowser.framework */; }; + 869D74FB1F6784CF00765F38 /* PhotoBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86AEF72D1EDEB9D100034DBA /* PhotoBrowser.framework */; }; AC570BBF1E247C550083620C /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC570BBE1E247C550083620C /* DetailViewController.swift */; }; /* End PBXBuildFile section */ @@ -40,7 +40,6 @@ 4A52D2171C72D13B001C257B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4A6BC7BB1C770DE100DACDA5 /* Kingfisher.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kingfisher.framework; path = Carthage/Build/iOS/Kingfisher.framework; sourceTree = ""; }; 86AEF72D1EDEB9D100034DBA /* PhotoBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PhotoBrowser.framework; path = "../Library/Developer/Xcode/DerivedData/PhotoBrowser-atvddxmpufwrrkfytkysyblmhonv/Build/Products/Debug-iphonesimulator/PhotoBrowser.framework"; sourceTree = ""; }; - A168310A1E7ABDC200AA1DC9 /* PhotoBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PhotoBrowser.framework; sourceTree = ""; }; AC570BBE1E247C550083620C /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -49,7 +48,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 86AEF72E1EDEB9D100034DBA /* PhotoBrowser.framework in Frameworks */, + 869D74FB1F6784CF00765F38 /* PhotoBrowser.framework in Frameworks */, 4A8EB7231CEF068D0065EAB0 /* Kingfisher.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -60,7 +59,6 @@ 4A52D1FF1C72D13B001C257B = { isa = PBXGroup; children = ( - A168310A1E7ABDC200AA1DC9 /* PhotoBrowser.framework */, 4A6BC7BB1C770DE100DACDA5 /* Kingfisher.framework */, 4A52D20A1C72D13B001C257B /* PhotoBrowserDemo */, 4A52D2091C72D13B001C257B /* Products */, diff --git a/PhotoBrowserDemo/ViewController.swift b/PhotoBrowserDemo/ViewController.swift index a78218c..375fa98 100644 --- a/PhotoBrowserDemo/ViewController.swift +++ b/PhotoBrowserDemo/ViewController.swift @@ -78,7 +78,10 @@ extension ViewController { browser.actionItems = [item1, item2, item3, item4] browser.photoBrowserDelegate = self browser.currentIndex = 0 - browser.enableShare = false +// browser.isFromPhotoPicker = true + browser.isShowMoreButton = false + +// browser.isPreviewMode = false presentPhotoBrowser(browser, fromView: imageView) } }