From 7df26e76c0ccfa8922b32ff051f76b78e3743034 Mon Sep 17 00:00:00 2001 From: gbelousov Date: Thu, 1 Jul 2021 12:44:21 +0700 Subject: [PATCH] custom init for CLRatioMenuItem --- .../CLClippingTool/CLClippingTool.m | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CLImageEditor/ImageTools/CLClippingTool/CLClippingTool.m b/CLImageEditor/ImageTools/CLClippingTool/CLClippingTool.m index 2b2e5697..6a8aa532 100644 --- a/CLImageEditor/ImageTools/CLClippingTool/CLClippingTool.m +++ b/CLImageEditor/ImageTools/CLClippingTool/CLClippingTool.m @@ -692,6 +692,29 @@ - (CGFloat)ratio @implementation CLRatioMenuItem +- (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 = self.iconImageContentMode; + [self addSubview:_iconView]; + + _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _iconView.bottom + 5, W, 15)]; + _titleLabel.backgroundColor = [UIColor clearColor]; + _titleLabel.textColor = [CLImageEditorTheme toolbarTextColor]; + _titleLabel.font = [CLImageEditorTheme toolbarTextFont]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + [self addSubview:_titleLabel]; + } + return self; +} + - (void)setRatio:(CLRatio *)ratio { if(ratio != _ratio){