Skip to content

Commit

Permalink
#206 Corrected sticker icon thumbnails content mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
albertbori committed Dec 18, 2017
1 parent d6d2fbd commit a04d999
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.h
Expand Up @@ -17,6 +17,7 @@

@property (nonatomic, assign) NSString *title;
@property (nonatomic, assign) UIImage *iconImage;
@property (nonatomic, assign) UIViewContentMode iconImageContentMode;
@property (nonatomic, assign) BOOL selected;
@property (nonatomic, readonly) UIImageView *iconView;

Expand Down
8 changes: 7 additions & 1 deletion CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.m
Expand Up @@ -19,12 +19,13 @@ - (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.iconImageContentMode = UIViewContentModeScaleAspectFill;
CGFloat W = frame.size.width;

_iconView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, W-20, W-20)];
_iconView.clipsToBounds = YES;
_iconView.layer.cornerRadius = 5;
_iconView.contentMode = UIViewContentModeScaleAspectFill;
_iconView.contentMode = self.iconImageContentMode;
[self addSubview:_iconView];

_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _iconView.bottom + 5, W, 15)];
Expand Down Expand Up @@ -74,6 +75,11 @@ - (void)setIconImage:(UIImage *)iconImage
_iconView.image = iconImage;
}

- (void)setIconImageContentMode:(UIViewContentMode)iconImageContentMode
{
_iconView.contentMode = iconImageContentMode;
}

- (void)setUserInteractionEnabled:(BOOL)userInteractionEnabled
{
[super setUserInteractionEnabled:userInteractionEnabled];
Expand Down
1 change: 1 addition & 0 deletions OptionalImageTools/CLStickerTool/CLStickerTool.m
Expand Up @@ -144,6 +144,7 @@ - (void)setStickerMenu
CLToolbarMenuItem *view = [CLImageEditorTheme menuItemWithFrame:CGRectMake(x, 0, W, H) target:self action:@selector(tappedStickerPanel:) toolInfo:nil];
view.iconImage = [image aspectFit:CGSizeMake(50, 50)];
view.userInfo = @{@"filePath" : filePath};
view.iconImageContentMode = UIViewContentModeScaleAspectFit;

[_menuScroll addSubview:view];
x += W;
Expand Down

0 comments on commit a04d999

Please sign in to comment.