Skip to content

Commit

Permalink
Fix constraints issues on L0 Cells
Browse files Browse the repository at this point in the history
  • Loading branch information
ijerryhale committed Jun 14, 2018
1 parent 6bfadc9 commit 49723fb
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 38 deletions.
Binary file not shown.
16 changes: 8 additions & 8 deletions movies/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Run Time:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="loh-vg-4U3" customClass="LabelPadded" customModule="movies" customModuleProvider="target">
<rect key="frame" x="103" y="95" width="100" height="16"/>
<rect key="frame" x="102" y="95" width="100" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="ArialMT" family="Arial" pointSize="14"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -247,7 +247,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Release Date:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EDJ-Ex-TBt" customClass="LabelPadded" customModule="movies" customModuleProvider="target">
<rect key="frame" x="103" y="75" width="100" height="16"/>
<rect key="frame" x="102" y="75" width="100" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="ArialMT" family="Arial" pointSize="14"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -280,7 +280,7 @@
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" semanticContentAttribute="forceRightToLeft" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" reversesTitleShadowWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="E2B-g2-ot5" userLabel="View In iTunes">
<rect key="frame" x="105" y="48" width="137" height="22"/>
<rect key="frame" x="104" y="48" width="137" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<state key="normal" title="iTunes Preview " image="gotoarrow">
Expand Down Expand Up @@ -344,7 +344,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Rating" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wgS-hl-6PZ">
<rect key="frame" x="307" y="4" width="47" height="20"/>
<rect key="frame" x="306" y="4" width="47" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -456,7 +456,7 @@
</connections>
</button>
<slider opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="pwK-Np-gDS">
<rect key="frame" x="153" y="284" width="204" height="31"/>
<rect key="frame" x="152" y="284" width="204" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<connections>
<action selector="sliderDidChange:" destination="bOL-p8-veW" eventType="valueChanged" id="bzL-Dd-5g8"/>
Expand All @@ -468,7 +468,7 @@
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="3"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidht">
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<integer key="value" value="1"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="nil" keyPath="borderColor"/>
Expand Down Expand Up @@ -512,7 +512,7 @@
</connections>
</button>
<label autoresizesSubviews="NO" opaque="NO" userInteractionEnabled="NO" contentMode="top" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EOU-Yv-0Dj">
<rect key="frame" x="70" y="134" width="214" height="107"/>
<rect key="frame" x="69" y="134" width="214" height="107"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
Expand All @@ -527,7 +527,7 @@
</state>
</button>
<view autoresizesSubviews="NO" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0TS-Ir-nTl" customClass="UIImageView">
<rect key="frame" x="94" y="14" width="166" height="105"/>
<rect key="frame" x="93" y="14" width="166" height="105"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ihD-C7-c5c">
Expand Down
24 changes: 10 additions & 14 deletions movies/Resource/CustomCell/L0_Cell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class L0_Cell: UITableViewHeaderFooterView
{
let disclosureButton = UIButton()
let backgroundview = UIView()

var delegate: SectionHeaderDelegate?
var section: Int = 0

Expand All @@ -26,31 +25,28 @@ class L0_Cell: UITableViewHeaderFooterView
override init(reuseIdentifier: String?)
{ super.init(reuseIdentifier: reuseIdentifier)

let marginGuide = contentView.layoutMarginsGuide

contentView.backgroundColor = UIColor.clear
backgroundview.setBorderColor(UIColor.themeColor(THEME_COLOR))
backgroundview.setCornerRadius(3)
backgroundview.setBorderWidth(1)
backgroundview.backgroundColor = UIColor.themeColor(THEME_COLOR)

contentView.addSubview(backgroundview)

contentView.addSubview(backgroundview)

backgroundview.translatesAutoresizingMaskIntoConstraints = false
backgroundview.leftAnchor.constraint(equalTo: marginGuide.leftAnchor, constant:-11).isActive = true
backgroundview.rightAnchor.constraint(equalTo: marginGuide.rightAnchor, constant:11).isActive = true
backgroundview.topAnchor.constraint(equalTo: marginGuide.topAnchor, constant:-6).isActive = true
backgroundview.bottomAnchor.constraint(equalTo: marginGuide.bottomAnchor, constant:6).isActive = true
backgroundview.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: 4).isActive = true
backgroundview.widthAnchor.constraint(equalTo: contentView.widthAnchor, multiplier: 0.98).isActive = true

backgroundview.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 2).isActive = true
backgroundview.heightAnchor.constraint(equalTo: contentView.heightAnchor, multiplier: 0.92).isActive = true

disclosureButton.setImage(UIImage(named: "carat.png"), for: UIControlState.normal)
disclosureButton.setImage(UIImage(named: "carat-open.png"), for: UIControlState.selected)

contentView.addSubview(disclosureButton)

disclosureButton.translatesAutoresizingMaskIntoConstraints = false
disclosureButton.widthAnchor.constraint(equalToConstant: 26).isActive = true
disclosureButton.topAnchor.constraint(equalTo: marginGuide.topAnchor, constant:4).isActive = true
disclosureButton.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant:4).isActive = true
disclosureButton.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
disclosureButton.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant:12).isActive = true

disclosureButton.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(L0_Cell.tapExpandCollapse(_:))))

Expand Down
18 changes: 10 additions & 8 deletions movies/Resource/CustomCell/L0_Cell_movie.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class L0_Cell_movie: L0_Cell
override init(reuseIdentifier: String?)
{ super.init(reuseIdentifier: reuseIdentifier)

let marginGuide = contentView.layoutMarginsGuide
let red = CGFloat((0x333333 & 0xFF0000) >> 16) / 255.0
let green = CGFloat((0x333333 & 0x00FF00) >> 8) / 255.0
let blue = CGFloat(0x333333 & 0x00FF) / 255.0
Expand All @@ -32,13 +31,13 @@ class L0_Cell_movie: L0_Cell

contentView.addSubview(title)

title.topAnchor.constraint(equalTo: marginGuide.topAnchor, constant:6).isActive = true
title.leftAnchor.constraint(equalTo: marginGuide.leftAnchor, constant:10).isActive = true
title.rightAnchor.constraint(equalTo: marginGuide.rightAnchor, constant:-20).isActive = true

title.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant:28).isActive = true
title.widthAnchor.constraint(equalTo: contentView.widthAnchor, multiplier: 0.81).isActive = true
title.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
title.isUserInteractionEnabled = true
title.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(L0_Cell.tapExpandCollapse(_:))))

rating.font = UIFont(name: "Arial", size: 14)
rating.textColor = UIColor(red: red, green: green, blue: blue, alpha: 1.0)

Expand All @@ -47,10 +46,13 @@ class L0_Cell_movie: L0_Cell

contentView.addSubview(rating)

rating.topAnchor.constraint(equalTo: marginGuide.topAnchor, constant:8).isActive = true
rating.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
rating.rightAnchor.constraint(equalTo: contentView.rightAnchor, constant:-8).isActive = true

rating.isUserInteractionEnabled = true

rating.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(L0_Cell.tapExpandCollapse(_:))))
}


}
}
13 changes: 7 additions & 6 deletions movies/Resource/CustomCell/L0_Cell_theater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class L0_Cell_theater: L0_Cell
override init(reuseIdentifier: String?)
{ super.init(reuseIdentifier: reuseIdentifier)

let marginGuide = contentView.layoutMarginsGuide
let red = CGFloat((0x333333 & 0xFF0000) >> 16) / 255.0
let green = CGFloat((0x333333 & 0x00FF00) >> 8) / 255.0
let blue = CGFloat(0x333333 & 0x00FF) / 255.0
Expand All @@ -39,14 +38,16 @@ class L0_Cell_theater: L0_Cell
name.translatesAutoresizingMaskIntoConstraints = false
name.textAlignment = .left
name.lineBreakMode = .byTruncatingMiddle
name.isUserInteractionEnabled = true
name.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(L0_Cell.tapExpandCollapse(_:))))

contentView.addSubview(name)

name.topAnchor.constraint(equalTo: marginGuide.topAnchor, constant:6).isActive = true
name.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant:28).isActive = true

name.widthAnchor.constraint(equalTo: contentView.widthAnchor, multiplier: 0.68).isActive = true
name.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true

name.isUserInteractionEnabled = true
name.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(L0_Cell.tapExpandCollapse(_:))))

distance.font = UIFont(name: "Arial", size: 14)
distance.textColor = UIColor(red: red, green: green, blue: blue, alpha: 1.0)

Expand All @@ -55,7 +56,7 @@ class L0_Cell_theater: L0_Cell

contentView.addSubview(distance)

distance.topAnchor.constraint(equalTo: marginGuide.topAnchor, constant:8).isActive = true
distance.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
distance.rightAnchor.constraint(equalTo: contentView.rightAnchor, constant:-8).isActive = true

distance.isUserInteractionEnabled = true
Expand Down
4 changes: 2 additions & 2 deletions movies/movies.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BUILD_TAG</key>
<string>0_9_00BF</string>
<string>0_9_00C0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -25,7 +25,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>191</string>
<string>192</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down

0 comments on commit 49723fb

Please sign in to comment.