Ver código fonte

menu: fix wifi upload cell layout

Felix Paul Kühne 9 anos atrás
pai
commit
a493de4da2
1 arquivos alterados com 9 adições e 5 exclusões
  1. 9 5
      Sources/VLCWiFiUploadTableViewCell.m

+ 9 - 5
Sources/VLCWiFiUploadTableViewCell.m

@@ -72,7 +72,6 @@
     self.uploadAddressLabel.shadowColor = [UIColor VLCDarkTextShadowColor];
     self.uploadAddressLabel.textColor = [UIColor whiteColor];
     self.uploadAddressLabel.font = [UIFont systemFontOfSize:12.0];
-    [self.uploadAddressLabel sizeToFit];
 
     self.serverOnButton = [UIButton buttonWithType:UIButtonTypeCustom];
     self.serverOnButton.translatesAutoresizingMaskIntoConstraints = NO;
@@ -83,14 +82,19 @@
 
 - (void)setupConstraints
 {
-    NSDictionary *dict = NSDictionaryOfVariableBindings(_titleLabel, _uploadAddressLabel, _serverOnButton);
+    UIView *spacer1 = [UIView new];
+    UIView *spacer2 = [UIView new];
+    spacer1.translatesAutoresizingMaskIntoConstraints = NO;
+    spacer2.translatesAutoresizingMaskIntoConstraints = NO;
+    [self.contentView addSubview:spacer1];
+    [self.contentView addSubview:spacer2];
+
+    NSDictionary *dict = NSDictionaryOfVariableBindings(_titleLabel, _uploadAddressLabel, _serverOnButton, spacer1, spacer2);
     
     [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_serverOnButton(50)]-==8-[_titleLabel]" options:0 metrics:0 views:dict]];
     [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_serverOnButton(50)]-==8-[_uploadAddressLabel]" options:0 metrics:0 views:dict]];
+    [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[spacer1][_titleLabel]-==0-[_uploadAddressLabel(>=0)][spacer2(==spacer1)]|" options:0 metrics:0 views:dict]];
     [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_serverOnButton(50)]|" options:0 metrics:0 views:dict]];
-
-    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]];
-    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_uploadAddressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]];
 }
 
 - (void)netReachabilityChanged