Skip to content

Commit

Permalink
Merge pull request #137 from brung/bng
Browse files Browse the repository at this point in the history
Adding in loading image fixes the weird aspect ratio

#127
  • Loading branch information
brung committed Feb 26, 2015
2 parents bbbc889 + 77083bf commit 9c99fa4
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 31 deletions.
2 changes: 1 addition & 1 deletion unnamed/HomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
[self.prototypePhotoCell layoutIfNeeded];
CGSize size = [self.prototypePhotoCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
// NSLog(@"Row %ld has height %f", indexPath.row, size.height);
return size.height;
return size.height + 1;
}
}

Expand Down
21 changes: 21 additions & 0 deletions unnamed/Images.xcassets/loading.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "iconmonstr-loading-10-icon-256 (1).png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 27 additions & 27 deletions unnamed/PhotoAnswerCell.xib
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,18 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="87C-Na-mHW">
<rect key="frame" x="10" y="10" width="338" height="288.5"/>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="87C-Na-mHW">
<rect key="frame" x="10" y="10" width="338" height="289"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9Di-a7-4ks" customClass="PhotoAnswerView">
<rect key="frame" x="16" y="127.5" width="145" height="145"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" secondItem="9Di-a7-4ks" secondAttribute="height" multiplier="1:1" id="Iz0-Ch-K9Y"/>
<constraint firstAttribute="width" constant="144" id="L05-3w-1eq"/>
<constraint firstAttribute="height" constant="144" id="oRI-Rv-z9m"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="L05-3w-1eq"/>
<exclude reference="oRI-Rv-z9m"/>
</mask>
</variation>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="GTb-uy-jZi" customClass="ProfileImageView">
<rect key="frame" x="8" y="8" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="5A4-tI-aFL"/>
<constraint firstAttribute="width" constant="40" id="PXr-TF-xwd"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cmh-ly-l7D">
<rect key="frame" x="56" y="8" width="235.5" height="17"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" misplaced="YES" text="Label" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cmh-ly-l7D">
<rect key="frame" x="56" y="8" width="236" height="17"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
Expand All @@ -51,8 +36,29 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XKC-a7-tDD" customClass="PhotoAnswerView">
<rect key="frame" x="177" y="127.5" width="145" height="145"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XJe-Z0-1tD">
<rect key="frame" x="299" y="8" width="31" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<view clipsSubviews="YES" contentMode="scaleAspectFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9Di-a7-4ks" customClass="PhotoAnswerView">
<rect key="frame" x="16" y="128" width="145" height="145"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" secondItem="9Di-a7-4ks" secondAttribute="height" multiplier="1:1" id="Iz0-Ch-K9Y"/>
<constraint firstAttribute="width" constant="144" id="L05-3w-1eq"/>
<constraint firstAttribute="height" constant="144" id="oRI-Rv-z9m"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="L05-3w-1eq"/>
<exclude reference="oRI-Rv-z9m"/>
</mask>
</variation>
</view>
<view clipsSubviews="YES" contentMode="scaleAspectFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XKC-a7-tDD" customClass="PhotoAnswerView">
<rect key="frame" x="177" y="128" width="145" height="145"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" secondItem="XKC-a7-tDD" secondAttribute="height" multiplier="1:1" id="Nyw-7O-btd"/>
Expand All @@ -67,12 +73,6 @@
</mask>
</variation>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XJe-Z0-1tD">
<rect key="frame" x="299" y="8" width="30.5" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
Expand Down
5 changes: 4 additions & 1 deletion unnamed/PhotoAnswerView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="0TJ-AY-mdA">
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="loading" translatesAutoresizingMaskIntoConstraints="NO" id="0TJ-AY-mdA">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<constraints>
<constraint firstAttribute="width" secondItem="0TJ-AY-mdA" secondAttribute="height" multiplier="1:1" id="evS-2A-k9x"/>
Expand All @@ -43,4 +43,7 @@
</constraints>
</view>
</objects>
<resources>
<image name="loading" width="256" height="256"/>
</resources>
</document>
5 changes: 3 additions & 2 deletions unnamed/ProfileViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
[self.prototypeSurveyCell layoutIfNeeded];
CGSize size = [self.prototypeSurveyCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
// NSLog(@"Row %ld has height %f", indexPath.row, size.height);
return size.height;
return size.height + 1;
} else {
[self configureCell:self.prototypePhotoCell forRowAtIndexPath:indexPath];
[self.prototypePhotoCell layoutIfNeeded];
CGSize size = [self.prototypePhotoCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
// NSLog(@"Row %ld has height %f", indexPath.row, size.height);
return size.height;
return size.height + 1;
}
}

Expand All @@ -175,6 +175,7 @@ - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
return cell;
} else {
if (indexPath.row == self.surveys.count && !self.isUpdating) {
self.pageIndex++;
if (self.surveys.count == (self.pageIndex * ResultCount)) {
[self fetchSurveys];
}
Expand Down

0 comments on commit 9c99fa4

Please sign in to comment.