Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Syntax cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
benguild committed Nov 25, 2018
1 parent ea19241 commit b4e0cb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions BGTableViewRowActionWithImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ + (instancetype)rowActionWithStyle:(UITableViewRowActionStyle)style

[title enumerateLinesUsingBlock:^(NSString * _Nonnull line, BOOL * _Nonnull stop) {
titleMaximumLineLength = MAX(titleMaximumLineLength, [line length]);
} ];
}];

float titleMultiplier = (isWidthFitted ? fittingMultiplier : (fontSize_actuallyUsedUnderImage / fontSize_iOS8AndUpDefault) / 1.1f);
// NOTE: This isn't exact, but it's close enough in most instances? I tested with full-width Asian characters and it accounts for those pretty well.

NSString *titleSpaceString = [@"" stringByPaddingToLength:titleMaximumLineLength*titleMultiplier
NSString *titleSpaceString = [@"" stringByPaddingToLength:(titleMaximumLineLength * titleMultiplier)
withString:@"\u3000"
startingAtIndex:0];

Expand All @@ -119,7 +119,7 @@ + (instancetype)rowActionWithStyle:(UITableViewRowActionStyle)style
attributes:@{ NSFontAttributeName: [UIFont systemFontOfSize:fontSize_iOS8AndUpDefault] }
context:nil].size.width;

CGSize frameGuess = CGSizeMake(ceilf((margin_horizontal_iOS8AndUp*2) + contentWidth), ceilf(cellHeight));
CGSize frameGuess = CGSizeMake(ceilf((margin_horizontal_iOS8AndUp * 2) + contentWidth), ceilf(cellHeight));

CGSize tripleFrame = CGSizeMake(frameGuess.width * 3.0f, frameGuess.height * 3.0f);

Expand All @@ -143,7 +143,9 @@ + (instancetype)rowActionWithStyle:(UITableViewRowActionStyle)style
[image drawAtPoint:CGPointMake((frameGuess.width / 2.0f) - ([image size].width / 2.0f),
(frameGuess.height / 2.0f) - imageInsetVertical)];

[title drawInRect:CGRectMake(((frameGuess.width / 2.0f) - (drawnTextSize.width / 2.0f)) * ([[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft ? -1 : 1),
[title drawInRect:CGRectMake(((frameGuess.width / 2.0f) -
(drawnTextSize.width / 2.0f)) *
([[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft ? -1 : 1),
(frameGuess.height / 2.0f) - imageInsetVertical + [image size].height + margin_vertical_betweenTextAndImage,
frameGuess.width,
frameGuess.height)
Expand Down
2 changes: 1 addition & 1 deletion BGTableViewRowActionWithImage.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "BGTableViewRowActionWithImage"
s.version = "0.4.5"
s.version = "0.4.6"
s.homepage = "https://github.com/benguild/BGTableViewRowActionWithImage"
s.screenshots = "https://raw.github.com/benguild/BGTableViewRowActionWithImage/master/demo.jpg"
s.summary = "A variation on the iOS 8-10 (not supported in 11+) `UITableViewRowAction` to support icons, with text below. Similar to the iOS 9 Mail app."
Expand Down

0 comments on commit b4e0cb5

Please sign in to comment.