Files
midi_ios/QXLive/Mine(音域)/View/个人主页/相册/QXPhotosToolsView.m

55 lines
1.9 KiB
Mathematica
Raw Normal View History

2025-08-14 10:07:49 +08:00
//
// QXPhotosToolsView.m
// QXLive
//
// Created by on 2025/6/5.
//
#import "QXPhotosToolsView.h"
#import "UIButton+QX.h"
@interface QXPhotosToolsView()
@property (nonatomic,strong)NSArray *toolsTitleArray;
@property (nonatomic,strong)NSArray *toolsImageArray;
@end
@implementation QXPhotosToolsView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 1)];
line.backgroundColor = RGB16(0xE2E2E2);
[self addSubview:line];
self.toolsTitleArray = @[QXText(@"分享"),QXText(@"移动"),QXText(@"删除")];
self.toolsImageArray = @[@"photos_share",@"photos_move",@"photos_delete"];
CGFloat btnWidth = self.width/self.toolsImageArray.count;
for (int i = 0; i < self.toolsTitleArray.count; i++) {
NSString *title = self.toolsTitleArray[i];
NSString *image = self.toolsImageArray[i];
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(i*btnWidth, 1, btnWidth, 49)];
[btn setTitle:title forState:(UIControlStateNormal)];
[btn setTitleColor:QXConfig.textColor forState:(UIControlStateNormal)];
btn.titleLabel.font = [UIFont systemFontOfSize:14];
[btn setImage:[UIImage imageNamed:image] forState:(UIControlStateNormal)];
btn.tag = 10+i;
[btn addTarget:self action:@selector(btnAction:) forControlEvents:(UIControlEventTouchUpInside)];
[btn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleTop) imageTitleSpace:2];
[self addSubview:btn];
}
}
-(void)btnAction:(UIButton*)sender{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickActionType:)]) {
[self.delegate didClickActionType:sender.tag];
}
}
@end