Skip to content

Commit 07b7b4b

Browse files
committed
Updated sample project for new screens also fixed CEWendel#244
1 parent ddcf6aa commit 07b7b4b

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

SWTableViewCell/PodFiles/SWTableViewCell.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,19 @@ - (void)layoutSubviews
315315
[self updateCellState];
316316
}
317317

318+
- (void)setFrame:(CGRect)frame
319+
{
320+
// Fix for new screen sizes
321+
// Initially, the cell is still 320 points wide
322+
// We need to layout our subviews again when this changes so our constraints clip to the right width
323+
BOOL widthChanged = (self.frame.size.width != frame.size.width);
324+
325+
[super setFrame:frame];
326+
327+
if (widthChanged)
328+
[self layoutIfNeeded];
329+
}
330+
318331
- (void)prepareForReuse
319332
{
320333
[super prepareForReuse];

SWTableViewCell/SWTableViewCell-Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<string>1.0</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
27+
<key>UILaunchStoryboardName</key>
28+
<string>MainStoryboard</string>
2729
<key>UIMainStoryboardFile</key>
2830
<string>MainStoryboard</string>
2931
<key>UIRequiredDeviceCapabilities</key>

SWTableViewCell/en.lproj/MainStoryboard.storyboard

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="HAv-OM-WVV">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="14A329f" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="HAv-OM-WVV">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
55
</dependencies>
66
<scenes>
7-
<!--View Controller - Root View Controller-->
7+
<!--Root View Controller-->
88
<scene sceneID="8UO-he-yD1">
99
<objects>
1010
<tableViewController id="gqK-s8-DTV" customClass="ViewController" sceneMemberID="viewController">
@@ -22,11 +22,9 @@
2222
<subviews>
2323
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="um.png" translatesAutoresizingMaskIntoConstraints="NO" id="mys-5a-TES">
2424
<rect key="frame" x="192" y="10" width="75" height="75"/>
25-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2625
</imageView>
2726
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AHM-FM-2Pc">
2827
<rect key="frame" x="20" y="10" width="165" height="75"/>
29-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
3028
<fontDescription key="fontDescription" type="system" pointSize="20"/>
3129
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
3230
<nil key="highlightedColor"/>

0 commit comments

Comments
 (0)