Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use token.frame.size to avoid namespace conflict with Masonry attributes #1

Merged
merged 2 commits into from
Nov 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PODS:
- KIF (3.3.0):
- KIF/Core (= 3.3.0)
- KIF/Core (3.3.0)
- VENTokenField (2.5.0):
- VENTokenField (2.5.1):
- FrameAccessor (~> 1.0)

DEPENDENCIES:
Expand All @@ -12,11 +12,11 @@ DEPENDENCIES:

EXTERNAL SOURCES:
VENTokenField:
:path: "."
:path: .

SPEC CHECKSUMS:
FrameAccessor: 0f7ba6ce37be9a5d0302a27c731dca70af8d438b
KIF: 0a82046d06f3648799cac522d2d0f7934214caac
VENTokenField: 746cc5d6b403bffc75cd21d0c1c320abed6f8c36
VENTokenField: 1eded13881dadb6f7ac4ca799bcbca71049c0b1e

COCOAPODS: 0.38.2
COCOAPODS: 0.39.0
32 changes: 32 additions & 0 deletions VENTokenField.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
B692A46C1954D9CA00344E36 /* Frameworks */,
B692A46D1954D9CA00344E36 /* Resources */,
83A0589C45D944989E3B327C /* Copy Pods Resources */,
FBA7028DF42D00F3F88C3D65 /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -209,6 +210,7 @@
B692A4891954D9CA00344E36 /* Frameworks */,
B692A48A1954D9CA00344E36 /* Resources */,
745245AF77574DF0A11EFB13 /* Copy Pods Resources */,
AC45044B475317A2C6DEB882 /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -320,6 +322,21 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VENTokenFieldSample/Pods-VENTokenFieldSample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
AC45044B475317A2C6DEB882 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VENTokenFieldSampleTests/Pods-VENTokenFieldSampleTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
D5857AF01C324E059F218F89 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -335,6 +352,21 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
FBA7028DF42D00F3F88C3D65 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VENTokenFieldSample/Pods-VENTokenFieldSample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
14 changes: 7 additions & 7 deletions VENTokenField/VENTokenField.m
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ - (void)layoutInputTextFieldWithCurrentX:(CGFloat *)currentX currentY:(CGFloat *

- (void)layoutCollapsedLabelWithCurrentX:(CGFloat *)currentX
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(*currentX, CGRectGetMinY(self.toLabel.frame), self.width - *currentX - self.horizontalInset, self.toLabel.height)];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(*currentX, CGRectGetMinY(self.toLabel.frame), self.frame.size.width - *currentX - self.horizontalInset, self.toLabel.frame.size.height)];
label.font = [UIFont fontWithName:@"HelveticaNeue" size:15.5];
label.text = [self collapsedText];
label.textColor = self.colorScheme;
Expand Down Expand Up @@ -312,18 +312,18 @@ - (void)layoutTokensWithCurrentX:(CGFloat *)currentX currentY:(CGFloat *)current

[self.tokens addObject:token];

if (*currentX + token.width <= self.scrollView.contentSize.width) { // token fits in current line
token.frame = CGRectMake(*currentX, *currentY, token.width, token.height);
if (*currentX + token.frame.size.width <= self.scrollView.contentSize.width) { // token fits in current line
token.frame = CGRectMake(*currentX, *currentY, token.frame.size.width, token.frame.size.height);
} else {
*currentY += token.height;
*currentY += token.frame.size.height;
*currentX = 0;
CGFloat tokenWidth = token.width;
CGFloat tokenWidth = token.frame.size.width;
if (tokenWidth > self.scrollView.contentSize.width) { // token is wider than max width
tokenWidth = self.scrollView.contentSize.width;
}
token.frame = CGRectMake(*currentX, *currentY, tokenWidth, token.height);
token.frame = CGRectMake(*currentX, *currentY, tokenWidth, token.frame.size.height);
}
*currentX += token.width + self.tokenPadding;
*currentX += token.frame.size.width + self.tokenPadding;
[self.scrollView addSubview:token];
}
}
Expand Down