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

Commit

Permalink
Merge branch 'feature/add-photo-broswer'
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce committed Oct 30, 2017
2 parents 3212076 + 17d8c1b commit 888102c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
22 changes: 13 additions & 9 deletions PhotoBrowser/PBCustomView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,22 @@ class PBNavigationBar: UIView {

func updateShareStatus(_ isEnableShare: Bool) {
self.removeConstraint(self.moreTrailingConstraint!)
self.moreTrailingConstraint = NSLayoutConstraint(item: self.moreButton, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1.0, constant: -15)
self.addConstraint(self.moreTrailingConstraint!)


if !isEnableShare {
rightButton.isHidden = true

// self.moreTrailingConstraint = NSLayoutConstraint(item: self, attribute: .trailing, relatedBy: .equal, toItem: contentView, attribute: .trailing, multiplier: 1.0, constant: -15)

self.moreTrailingConstraint = NSLayoutConstraint(item: self.moreButton, attribute: .trailing, relatedBy: .equal, toItem: contentView, attribute: .trailing, multiplier: 1.0, constant: -15)
self.addConstraint(self.moreTrailingConstraint!)

titleTrailingConstraint?.constant = 60
} else {
rightButton.isHidden = false

self.moreTrailingConstraint = NSLayoutConstraint(item: self.moreButton, attribute: .trailing, relatedBy: .equal, toItem: self.rightButton, attribute: .leading, multiplier: 1.0, constant: 0)
self.addConstraint(self.moreTrailingConstraint!)

titleTrailingConstraint?.constant = 85
}
layoutIfNeeded()
Expand All @@ -218,12 +228,6 @@ class PBNavigationBar: UIView {
layoutIfNeeded()
}

// func updateSkitchButton(_ isHiddenSkitch: Bool) {
// let skitchImage = isHiddenSkitch ? "filePreviewInvisibleIcon" : "filePreviewVisibleIcon"
// let image = UIImage(named: skitchImage, in: Bundle(for: classForCoder), compatibleWith: nil)
// moreButton.setImage(image, for: .normal)
// }

func setup() {
addSubview(backgroundView)
backgroundView.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
Expand Down
4 changes: 1 addition & 3 deletions PhotoBrowser/PhotoBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ open class PhotoBrowser: UIPageViewController {
open var enableShare = true {
didSet {
headerView?.rightButton.isHidden = !enableShare
if !enableShare {
headerView?.updateShareStatus(false)
}
headerView?.updateShareStatus(enableShare)
}
}

Expand Down

0 comments on commit 888102c

Please sign in to comment.