Prevent auto layout from messing with our labels even though we told it not to.

This commit is contained in:
Maurice Parker 2019-04-22 11:49:22 -05:00
parent 5b75add585
commit cd9a48d4b5
4 changed files with 25 additions and 3 deletions

View File

@ -18,6 +18,7 @@
512E09352268B25900BDCFDD /* UISplitViewController-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */; };
512E094D2268B8AB00BDCFDD /* DeleteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9C1FAE83C600ECDEDB /* DeleteCommand.swift */; };
517D9075226639F500323654 /* AddAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517D906B2266392900323654 /* AddAccountViewController.swift */; };
5183CCD0226E1E880010922C /* NonIntrinsicLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */; };
519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519B8D322143397200FA689C /* SharingServiceDelegate.swift */; };
51C451A9226377C200C03939 /* ArticlesDatabase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8407167F2262A61100344432 /* ArticlesDatabase.framework */; };
51C451AA226377C200C03939 /* ArticlesDatabase.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8407167F2262A61100344432 /* ArticlesDatabase.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@ -609,6 +610,7 @@
512E08F722688F7C00BDCFDD /* MasterTableViewSectionHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTableViewSectionHeader.swift; sourceTree = "<group>"; };
512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISplitViewController-Extensions.swift"; sourceTree = "<group>"; };
517D906B2266392900323654 /* AddAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountViewController.swift; sourceTree = "<group>"; };
5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicLabel.swift; sourceTree = "<group>"; };
519B8D322143397200FA689C /* SharingServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingServiceDelegate.swift; sourceTree = "<group>"; };
51C4524E226506F400C03939 /* UIStoryboard-Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIStoryboard-Extensions.swift"; sourceTree = "<group>"; };
51C4524F226506F400C03939 /* UIImage-Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage-Extensions.swift"; sourceTree = "<group>"; };
@ -904,6 +906,7 @@
51C45245226506C800C03939 /* Extensions */ = {
isa = PBXGroup;
children = (
5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */,
51C45250226506F400C03939 /* String-Extensions.swift */,
51C4524F226506F400C03939 /* UIImage-Extensions.swift */,
51C4524E226506F400C03939 /* UIStoryboard-Extensions.swift */,
@ -2185,6 +2188,7 @@
51C4529B22650A1000C03939 /* FaviconDownloader.swift in Sources */,
512E09012268907400BDCFDD /* MasterTableViewSectionHeader.swift in Sources */,
51C45268226508F600C03939 /* MasterUnreadCountView.swift in Sources */,
5183CCD0226E1E880010922C /* NonIntrinsicLabel.swift in Sources */,
51C452B1226510E600C03939 /* InitialFeedDownloader.swift in Sources */,
51C4529F22650A1900C03939 /* AuthorAvatarDownloader.swift in Sources */,
51C452A322650A1E00C03939 /* HTMLMetadataDownloader.swift in Sources */,

View File

@ -0,0 +1,18 @@
//
// MasterTimelineLabel.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 4/22/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import UIKit
class NonIntrinsicLabel: UILabel {
// Prevent autolayout from messing around with our frame settings
override var intrinsicContentSize: CGSize {
return CGSize(width: UIView.noIntrinsicMetric, height: UIView.noIntrinsicMetric)
}
}

View File

@ -85,7 +85,7 @@ class MasterTableViewCell : UITableViewCell {
}
private let titleView: UILabel = {
let label = UILabel()
let label = NonIntrinsicLabel()
label.numberOfLines = 1
label.lineBreakMode = .byTruncatingTail
label.allowsDefaultTighteningForTruncation = false

View File

@ -74,14 +74,14 @@ class MasterTimelineTableViewCell: UITableViewCell {
private extension MasterTimelineTableViewCell {
static func singleLineUILabel() -> UILabel {
let label = UILabel()
let label = NonIntrinsicLabel()
label.lineBreakMode = .byTruncatingTail
label.allowsDefaultTighteningForTruncation = false
return label
}
static func multiLineUILabel() -> UILabel {
let label = UILabel()
let label = NonIntrinsicLabel()
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
label.allowsDefaultTighteningForTruncation = false