Skip to content

Commit

Permalink
custom init for CLRatioMenuItem
Browse files Browse the repository at this point in the history
  • Loading branch information
khachapurya committed Jul 1, 2021
1 parent a17f01e commit 7df26e7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions CLImageEditor/ImageTools/CLClippingTool/CLClippingTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit 7df26e7

Please sign in to comment.