Skip to content
Open
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
1,777 changes: 1,230 additions & 547 deletions Examples/LikedOrNope/LikedOrNope.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Examples/LikedOrNope/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ DEPENDENCIES:
- MDCSwipeToChoose

SPEC CHECKSUMS:
MDCSwipeToChoose: 466ac0928b7658c49c14fac77896f366383dcdf6
MDCSwipeToChoose: d689e0589ad2d7c6e831176e7a4bebde459328f2

COCOAPODS: 0.32.1
COCOAPODS: 0.34.4
2 changes: 2 additions & 0 deletions MDCSwipeToChoose/Internal/Views/UIView+MDCBorderedLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@
color:(UIColor *)color
angle:(CGFloat)angle;

- (void)constructBorderedLabelWithText:(NSString *)text color:(UIColor *)color angle:(CGFloat)angle borderWidth:(NSNumber *)borderWidth font:(UIFont *)font;

@end
9 changes: 7 additions & 2 deletions MDCSwipeToChoose/Internal/Views/UIView+MDCBorderedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ @implementation UIView (MDCBorderedLabel)
- (void)constructBorderedLabelWithText:(NSString *)text
color:(UIColor *)color
angle:(CGFloat)angle {
[self constructBorderedLabelWithText:text color:color angle:angle borderWidth:nil font:nil];
}

- (void)constructBorderedLabelWithText:(NSString *)text color:(UIColor *)color angle:(CGFloat)angle borderWidth:(NSNumber *)borderWidth font:(UIFont *)font
{
self.layer.borderColor = color.CGColor;
self.layer.borderWidth = 5.f;
self.layer.borderWidth = borderWidth ? [borderWidth floatValue] : 5.f;
self.layer.cornerRadius = 10.f;

UILabel *label = [[UILabel alloc] initWithFrame:self.bounds];
label.text = [text uppercaseString];
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont fontWithName:@"HelveticaNeue-CondensedBlack"
label.font = font ? font : [UIFont fontWithName:@"HelveticaNeue-CondensedBlack"
size:48.f];
label.textColor = color;
[self addSubview:label];
Expand Down
24 changes: 24 additions & 0 deletions MDCSwipeToChoose/Public/Options/MDCSwipeToChooseViewOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@
*/
@property (nonatomic, strong) UIColor *likedColor;

/*!
* The font of the text of the `likedView`. A default value is provided in the
* `-init` method.
*/
@property (nonatomic, strong) UIFont *likedFont;

/*!
* The border width of the `likedView`. A default value is provided in the
* `-init` method.
*/
@property (nonatomic, strong) NSNumber *likedBorderWidth;

/*!
* The rotation angle of the `likedView`. A default value is provided in the
* `-init` method.
Expand All @@ -66,6 +78,18 @@
*/
@property (nonatomic, strong) UIColor *nopeColor;

/*!
* The font of the text of the `nopeView`. A default value is provided in the
* `-init` method.
*/
@property (nonatomic, strong) UIFont *nopeFont;

/*!
* The border width of the `nopeView`. A default value is provided in the
* `-init` method.
*/
@property (nonatomic, strong) NSNumber *nopeBorderWidth;

/*!
* The rotation angle of the `nopeView`. A default value is provided in the
* `-init` method.
Expand Down
9 changes: 7 additions & 2 deletions MDCSwipeToChoose/Public/Views/MDCSwipeToChooseView.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ - (void)constructLikedView {
self.likedView = [[UIView alloc] initWithFrame:frame];
[self.likedView constructBorderedLabelWithText:self.options.likedText
color:self.options.likedColor
angle:self.options.likedRotationAngle];
angle:self.options.likedRotationAngle
borderWidth:self.options.likedBorderWidth
font:self.options.likedFont];

self.likedView.alpha = 0.f;
[self.imageView addSubview:self.likedView];
}
Expand All @@ -94,7 +97,9 @@ - (void)constructNopeImageView {
MDCSwipeToChooseViewLabelWidth)];
[self.nopeView constructBorderedLabelWithText:self.options.nopeText
color:self.options.nopeColor
angle:self.options.nopeRotationAngle];
angle:self.options.nopeRotationAngle
borderWidth:self.options.nopeBorderWidth
font:self.options.nopeFont];
self.nopeView.alpha = 0.f;
[self.imageView addSubview:self.nopeView];
}
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ The following is an example of how you can use `MDCSwipeToChooseView` to display
options.delegate = self;
options.likedText = @"Keep";
options.likedColor = [UIColor blueColor];
options.likedFont = [UIFont fontWithName:@"HelveticaNeue-CondensedBlack"
size:48.f];
options.nopeText = @"Delete";
options.nopeBorderWidth = @(5);
options.onPan = ^(MDCPanState *state){
if (state.thresholdRatio == 1.f && state.direction == MDCSwipeDirectionLeft) {
NSLog(@"Let go now to delete the photo!");
Expand Down