From 37523ba5e57c29e30b6b494e4e18d4c8784d6b78 Mon Sep 17 00:00:00 2001 From: Miguel Revetria Date: Mon, 5 Sep 2016 14:30:48 -0300 Subject: [PATCH] Fixes #12 by removing specific constraint code --- .../CustomActionControllers/PeriscopeCell.xib | 12 +++---- Example/CustomActionControllers/Twitter.swift | 15 +++++++-- .../CustomActionControllers/TwitterCell.xib | 32 +++++-------------- .../CustomActionControllers/YoutubeCell.xib | 16 +++------- Source/ActionCell.swift | 13 -------- 5 files changed, 29 insertions(+), 59 deletions(-) diff --git a/Example/CustomActionControllers/PeriscopeCell.xib b/Example/CustomActionControllers/PeriscopeCell.xib index 7f69872..ae2c592 100644 --- a/Example/CustomActionControllers/PeriscopeCell.xib +++ b/Example/CustomActionControllers/PeriscopeCell.xib @@ -1,8 +1,8 @@ - + - + @@ -14,25 +14,21 @@ - - - diff --git a/Example/CustomActionControllers/Twitter.swift b/Example/CustomActionControllers/Twitter.swift index 1304d8f..dd14daf 100644 --- a/Example/CustomActionControllers/Twitter.swift +++ b/Example/CustomActionControllers/Twitter.swift @@ -28,7 +28,9 @@ import XLActionController #endif public class TwitterCell: ActionCell { - + + @IBOutlet weak var imageViewWidthConstraint: NSLayoutConstraint! + public override init(frame: CGRect) { super.init(frame: frame) initialize() @@ -42,7 +44,15 @@ public class TwitterCell: ActionCell { super.awakeFromNib() initialize() } - + + public override func setup(title: String?, detail: String?, image: UIImage?) { + super.setup(title, detail: detail, image: image) + + imageViewWidthConstraint.constant = image == nil ? 0 : 36 + + setNeedsLayout() + } + func initialize() { backgroundColor = .whiteColor() actionImageView?.clipsToBounds = true @@ -102,7 +112,6 @@ public class TwitterActionController: ActionController - + - - + @@ -17,7 +16,6 @@ - @@ -25,39 +23,26 @@ - - - + - - - - - - - - - @@ -67,21 +52,20 @@ - + - + - - + diff --git a/Example/CustomActionControllers/YoutubeCell.xib b/Example/CustomActionControllers/YoutubeCell.xib index b28a81f..93e9740 100644 --- a/Example/CustomActionControllers/YoutubeCell.xib +++ b/Example/CustomActionControllers/YoutubeCell.xib @@ -1,8 +1,8 @@ - + - + @@ -17,7 +17,6 @@ - @@ -32,31 +31,26 @@ - - - + - + - - diff --git a/Source/ActionCell.swift b/Source/ActionCell.swift index 2c5f99d..6712cee 100644 --- a/Source/ActionCell.swift +++ b/Source/ActionCell.swift @@ -40,21 +40,8 @@ public class ActionCell: UICollectionViewCell, SeparatorCellType { actionTitleLabel?.text = title actionDetailLabel?.text = detail actionImageView?.image = image - - if let _ = image { - actionTitleLabelConstraintToContainer?.priority = UILayoutPriorityDefaultHigh - actionTitleLabelConstraintToImageView?.priority = UILayoutPriorityRequired - } else { - actionTitleLabelConstraintToContainer?.priority = UILayoutPriorityRequired - actionTitleLabelConstraintToImageView?.priority = UILayoutPriorityDefaultHigh - } } - - @IBOutlet private weak var actionTitleLabelConstraintToContainer: NSLayoutConstraint? - @IBOutlet private weak var actionTitleLabelConstraintToImageView: NSLayoutConstraint? - - public func showSeparator() { separatorView?.alpha = 1.0 }