Browse Source

Improve width button Notification

marinofaggiana 5 years ago
parent
commit
9c8620c125

+ 2 - 0
iOSClient/Notification/CCNotification.storyboard

@@ -140,8 +140,10 @@
                                     <outlet property="message" destination="9fz-sr-8Gv" id="3Zx-pz-gEK"/>
                                     <outlet property="messageBottomMargin" destination="FnM-0E-rXs" id="Pf6-Au-H7E"/>
                                     <outlet property="primary" destination="sMh-G7-FLo" id="oyl-c8-sTP"/>
+                                    <outlet property="primaryWidth" destination="tiI-55-Qu5" id="8H6-cf-vtP"/>
                                     <outlet property="remove" destination="9mD-Qe-1wu" id="r1h-mr-5U9"/>
                                     <outlet property="secondary" destination="obR-h7-TUC" id="oeU-ya-VU7"/>
+                                    <outlet property="secondaryWidth" destination="sVc-6c-vO4" id="fVg-jk-phh"/>
                                     <outlet property="subject" destination="pg1-7p-7Rz" id="FP7-vS-vEk"/>
                                 </connections>
                             </tableViewCell>

+ 13 - 0
iOSClient/Notification/CCNotification.swift

@@ -181,6 +181,17 @@ class CCNotification: UITableViewController, CCNotificationCelllDelegate {
                 }
             }
             
+            let widthPrimary = cell.primary.intrinsicContentSize.width + 30;
+            let widthSecondary = cell.secondary.intrinsicContentSize.width + 30;
+            
+            if widthPrimary > widthSecondary {
+                cell.primaryWidth.constant = widthPrimary
+                cell.secondaryWidth.constant = widthPrimary
+            } else {
+                cell.primaryWidth.constant = widthSecondary
+                cell.secondaryWidth.constant = widthSecondary
+            }
+            
             cell.messageBottomMargin.constant = 40
         }
         
@@ -268,6 +279,8 @@ class CCNotificationCell: UITableViewCell {
 
     @IBOutlet weak var avatarLeadingMargin: NSLayoutConstraint!
     @IBOutlet weak var messageBottomMargin: NSLayoutConstraint!
+    @IBOutlet weak var primaryWidth: NSLayoutConstraint!
+    @IBOutlet weak var secondaryWidth: NSLayoutConstraint!
     
     override func awakeFromNib() {
         super.awakeFromNib()