Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9036619
fix init at STXAttributedLabel.m
ulukaya Apr 14, 2016
73f07e3
fix STXCaptionCell.h
ulukaya Apr 14, 2016
6843712
fix missing imports
ulukaya Apr 14, 2016
c0bfbb1
fix missing imports
ulukaya Apr 14, 2016
f5c300e
Merge branch 'master' of https://github.com/iulukaya/STXDynamicTableView
ulukaya Apr 14, 2016
2e4576c
fix headers
ulukaya Apr 14, 2016
32df0b3
fix headers
ulukaya Apr 14, 2016
b4d11ca
fix headers
ulukaya Apr 14, 2016
fd64389
fix headers
ulukaya Apr 14, 2016
c6514b5
fix headers
ulukaya Apr 14, 2016
7b3a970
fix headers
ulukaya Apr 14, 2016
c0eb633
Merge branch 'master' of https://github.com/iulukaya/STXDynamicTableView
ulukaya Apr 14, 2016
11d34d6
fix headers
ulukaya Apr 14, 2016
b37fe06
fix headers
ulukaya Apr 14, 2016
474ac5d
add podspec
ulukaya Apr 14, 2016
50658b4
add postItem and indexPath to userActionCell
ulukaya Apr 14, 2016
a3287f8
connect user actions to existing IBOutlets
ulukaya Apr 14, 2016
b4031e4
move useractioncell to top
ulukaya Apr 14, 2016
83f47fa
using open source images for user action buttons
ulukaya Apr 14, 2016
adbbf8b
using open source images for user action buttons
ulukaya Apr 14, 2016
91bc91f
Merge branch 'master' of https://github.com/iulukaya/STXDynamicTableView
ulukaya Apr 14, 2016
3b6b81d
likes instead of loves
ulukaya Apr 14, 2016
7dba337
removing podspec
ulukaya Apr 15, 2016
a708222
fixing issue with bundles
ulukaya Jul 24, 2017
0912ccd
Update .travis.yml
ulukaya Jul 25, 2017
a66a76d
Update STXFeedTableViewDelegate.m
ulukaya Sep 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ install:
- bundle exec pod install
script:
- "./build.sh"
osx_image: xcode7
osx_image: xcode8.3
env:
global:
- REPO_SLUG="2359media/STXDynamicTableView"
Expand Down
1 change: 1 addition & 0 deletions STXDynamicTableView/Cells/STXCaptionCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

@import UIKit;
#import "STXUserItem.h"

@class STXCaptionCell;

Expand Down
2 changes: 2 additions & 0 deletions STXDynamicTableView/Cells/STXCaptionCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import "STXCaptionCell.h"
#import "STXAttributedLabel.h"
#import <PureLayout/PureLayout.h>
#import <UALogger/UALogger.h>

static CGFloat STXCaptionViewLeadingEdgeInset = 10.f;
static CGFloat STXCaptionViewTrailingEdgeInset = 10.f;
Expand Down
1 change: 1 addition & 0 deletions STXDynamicTableView/Cells/STXCommentCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

@import UIKit;
#import "STXCommentItem.h"

typedef NS_ENUM(int16_t, STXCommentCellStyle) {
STXCommentCellStyleSingleComment,
Expand Down
3 changes: 3 additions & 0 deletions STXDynamicTableView/Cells/STXCommentCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#import "STXCommentCell.h"
#import "STXAttributedLabel.h"
#import "STXUserItem.h"
#import <PureLayout/PureLayout.h>
#import <UALogger/UALogger.h>

static CGFloat STXCommentViewLeadingEdgeInset = 10.f;
static CGFloat STXCommentViewTrailingEdgeInset = 10.f;
Expand Down
2 changes: 2 additions & 0 deletions STXDynamicTableView/Cells/STXFeedPhotoCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

@import UIKit;
#import "STXUserItem.h"
#import "STXPostItem.h"

@protocol STXFeedPhotoCellDelegate <NSObject>

Expand Down
2 changes: 2 additions & 0 deletions STXDynamicTableView/Cells/STXFeedPhotoCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#import "STXFeedPhotoCell.h"

#import "UIImageView+Masking.h"
#import <MHPrettyDate/MHPrettyDate.h>
#import <AFNetworking/UIImageView+AFNetworking.h>

@interface STXFeedPhotoCell ()

Expand Down
29 changes: 19 additions & 10 deletions STXDynamicTableView/Cells/STXFeedPhotoCell.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -15,11 +19,11 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SjJ-hL-MAV" userLabel="Container">
<rect key="frame" x="6" y="6" width="588" height="337.5"/>
<rect key="frame" x="6" y="6" width="588" height="338"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kqs-ch-WXe" userLabel="Feed Photo Image View">
<rect key="frame" x="0.0" y="36" width="588" height="300"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="d8r-Uw-tpQ"/>
</constraints>
Expand All @@ -32,19 +36,19 @@
</constraints>
</imageView>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hvo-1V-Ibr" userLabel="Profile Name Label">
<rect key="frame" x="52" y="9" width="530" height="20.5"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<rect key="frame" x="52" y="9" width="530" height="21"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8o4-fH-CVs" userLabel="Date Label">
<rect key="frame" x="543" y="10" width="42" height="20.5"/>
<rect key="frame" x="543" y="10" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kqs-ch-WXe" firstAttribute="leading" secondItem="SjJ-hL-MAV" secondAttribute="leading" id="0GL-bk-6mq"/>
<constraint firstItem="2TE-OO-Yt5" firstAttribute="leading" secondItem="SjJ-hL-MAV" secondAttribute="leading" id="67s-Dy-Z05"/>
Expand Down Expand Up @@ -74,4 +78,9 @@
</connections>
</tableViewCell>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
</document>
9 changes: 6 additions & 3 deletions STXDynamicTableView/Cells/STXLikesCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//

#import "STXLikesCell.h"
#import <TTTAttributedLabel/TTTAttributedLabel.h>
#import <PureLayout/PureLayout.h>
#import <UALogger/UALogger.h>

static CGFloat STXLikesViewLeadingEdgeInset = 10.f;
static CGFloat STXLikesViewTrailingEdgeInset = 10.f;
Expand Down Expand Up @@ -87,7 +90,7 @@ - (void)setLikes:(NSDictionary *)likes
- (void)setLikesLabel:(TTTAttributedLabel *)likesLabel count:(NSInteger)count
{
NSString *countString = [@(count) stringValue];
NSString *title = [NSString stringWithFormat:NSLocalizedString(@"%@ loves", nil), countString];
NSString *title = [NSString stringWithFormat:NSLocalizedString(@"%@ likes", nil), countString];
likesLabel.text = title;
}

Expand All @@ -109,9 +112,9 @@ - (void)setLikersLabel:(TTTAttributedLabel *)likersLabel likers:(NSArray *)liker

if ([likersString length] > 0) {
if ([likerNames count] == 1) {
[likersString appendString:NSLocalizedString(@" loves this", nil)];
[likersString appendString:NSLocalizedString(@" likes this", nil)];
} else {
[likersString appendString:NSLocalizedString(@" love this", nil)];
[likersString appendString:NSLocalizedString(@" like this", nil)];
}
}

Expand Down
1 change: 1 addition & 0 deletions STXDynamicTableView/Cells/STXUserActionCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

@import UIKit;
#import "STXPostItem.h"

@class STXUserActionCell;

Expand Down
26 changes: 5 additions & 21 deletions STXDynamicTableView/Cells/STXUserActionCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#import "STXUserActionCell.h"

#import "UIButton+STXButton.h"

@interface STXUserActionCell ()

@property (weak, nonatomic) IBOutlet UIButton *likeButton;
Expand Down Expand Up @@ -49,28 +47,17 @@ - (void)setSelected:(BOOL)selected animated:(BOOL)animated
- (void)setPostItem:(id<STXPostItem>)postItem
{
_postItem = postItem;

NSString *likeButtonTitle = postItem.liked ? NSLocalizedString(@"Loved", nil) : NSLocalizedString(@"Love", nil);
[self.likeButton setTitle:likeButtonTitle forState:UIControlStateNormal];

if (postItem.liked) {
[self.likeButton stx_setSelectedAppearance];
} else {
[self.likeButton stx_setNormalAppearance];
}

[self.likeButton setImage:[UIImage imageNamed:(postItem.liked ? @"ic_favorite" : @"ic_favorite_border") inBundle:[NSBundle bundleForClass:[STXUserActionCell class]] compatibleWithTraitCollection:nil]
forState:UIControlStateNormal];
}

#pragma mark - Action

- (void)setButton:(UIButton *)button toLoved:(BOOL)loved
{
if (loved) {
[button setTitle:NSLocalizedString(@"Loved", nil) forState:UIControlStateNormal];
[button stx_setSelectedAppearance];
} else {
[button setTitle:NSLocalizedString(@"Love", nil) forState:UIControlStateNormal];
[button stx_setNormalAppearance];
}
[self.likeButton setImage:[UIImage imageNamed:(loved ? @"ic_favorite" : @"ic_favorite_border") inBundle:[NSBundle bundleForClass:[STXUserActionCell class]] compatibleWithTraitCollection:nil]
forState:UIControlStateNormal];
}

- (IBAction)like:(id)sender
Expand All @@ -81,9 +68,6 @@ - (IBAction)like:(id)sender
return;
}

// Prevent rapid interaction
[sender setUserInteractionEnabled:NO];

if (![self.postItem liked]) {
[self setButton:sender toLoved:YES];

Expand Down
61 changes: 42 additions & 19 deletions STXDynamicTableView/Cells/STXUserActionCell.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -15,35 +19,44 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S4R-5B-KND">
<rect key="frame" x="10" y="9" width="190.5" height="30"/>
<state key="normal" title="Love">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S4R-5B-KND">
<rect key="frame" x="94" y="12" width="24" height="24"/>
<state key="normal" image="ic_favorite_border">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="like:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="rIj-xT-O93"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IWo-cB-LDF" userLabel="Button Divider">
<rect key="frame" x="200" y="8" width="1" height="28"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<rect key="frame" x="200.5" y="8" width="1" height="28"/>
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="5Ry-u4-r2a"/>
<constraint firstAttribute="height" constant="28" id="wJf-kH-xA5"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xcU-Ci-npS">
<rect key="frame" x="200.5" y="9" width="191" height="30"/>
<state key="normal" title="Comment">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xcU-Ci-npS">
<rect key="frame" x="285" y="12" width="24" height="24"/>
<state key="normal" image="ic_comment">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="comment:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="kTC-WX-avq"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Enb-uG-skx">
<rect key="frame" x="391" y="9" width="190.5" height="30"/>
<state key="normal" title="Share">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Enb-uG-skx">
<rect key="frame" x="475" y="12" width="24" height="24"/>
<state key="normal" image="ic_share">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="share:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="BMx-Yn-2Rm"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vWy-01-QxB" userLabel="Button Divider">
<rect key="frame" x="390" y="8" width="1" height="28"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<rect key="frame" x="390.5" y="8" width="1" height="28"/>
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="bSV-vc-pLa"/>
<constraint firstAttribute="width" constant="1" id="hjc-sV-nyx"/>
Expand Down Expand Up @@ -78,4 +91,14 @@
<point key="canvasLocation" x="418" y="239"/>
</tableViewCell>
</objects>
<resources>
<image name="ic_comment" width="24" height="24"/>
<image name="ic_favorite_border" width="24" height="24"/>
<image name="ic_share" width="24" height="24"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images": [
{
"filename": "ic_comment.png",
"idiom": "universal",
"scale": "1x"
},
{
"filename": "ic_comment_2x.png",
"idiom": "universal",
"scale": "2x"
},
{
"filename": "ic_comment_3x.png",
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images": [
{
"filename": "ic_favorite.png",
"idiom": "universal",
"scale": "1x"
},
{
"filename": "ic_favorite_2x.png",
"idiom": "universal",
"scale": "2x"
},
{
"filename": "ic_favorite_3x.png",
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images": [
{
"filename": "ic_favorite_border.png",
"idiom": "universal",
"scale": "1x"
},
{
"filename": "ic_favorite_border_2x.png",
"idiom": "universal",
"scale": "2x"
},
{
"filename": "ic_favorite_border_3x.png",
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading