diff --git a/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.h b/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.h index 5d164bc6..7da4fa89 100644 --- a/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.h +++ b/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.h @@ -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; diff --git a/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.m b/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.m index 8d3ab9bc..e17c2e11 100644 --- a/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.m +++ b/CLImageEditor/ImageTools/ToolSettings/CLToolbarMenuItem.m @@ -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)]; @@ -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]; diff --git a/OptionalImageTools/CLStickerTool/CLStickerTool.m b/OptionalImageTools/CLStickerTool/CLStickerTool.m index e69aa1d6..1b7d41ee 100644 --- a/OptionalImageTools/CLStickerTool/CLStickerTool.m +++ b/OptionalImageTools/CLStickerTool/CLStickerTool.m @@ -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;