- theme
- host card actions including long press - add host button
This commit is contained in:
1 parent
6ae3beb2a5
commit
049034e5a9
14 files changed
+628
-383
No files matched your search
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// FixedTintImageView.m
|
||||
// Moonlight-ZWM
|
||||
//
|
||||
// Created by Weimin on 2025/6/1.
|
||||
// Copyright © 2025 Moonlight Game Streaming Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FixedTintImageView.h"
|
||||
|
||||
|
||||
@interface FixedTintButton()
|
||||
@property (nonatomic, strong) UIColor *fixedTintColor;
|
||||
@end
|
||||
|
||||
@implementation FixedTintButton
|
||||
|
||||
- (void)tintColorDidChange {
|
||||
[super tintColorDidChange];
|
||||
// 强制 tint 保持固定颜色
|
||||
if (self.fixedTintColor) {
|
||||
[self setImage:[self.imageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] forState:UIControlStateNormal];
|
||||
self.tintColor = self.fixedTintColor;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTintColor:(UIColor *)tintColor {
|
||||
_fixedTintColor = tintColor;
|
||||
[super setTintColor:tintColor];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface FixedTintImageView ()
|
||||
@property (nonatomic, strong) UIColor *fixedTintColor;
|
||||
@end
|
||||
|
||||
@implementation FixedTintImageView
|
||||
|
||||
- (instancetype)initWithImage:(UIImage *)image {
|
||||
self = [super initWithImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]];
|
||||
if (self) {
|
||||
// _fixedTintColor = [UIColor systemBlueColor]; // 默认颜色
|
||||
if(_fixedTintColor != nil) [super setTintColor:_fixedTintColor];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setTintColor:(UIColor *)tintColor {
|
||||
if(_fixedTintColor == nil && tintColor != nil) _fixedTintColor = tintColor;
|
||||
if(tintColor != nil) [super setTintColor:tintColor];
|
||||
}
|
||||
|
||||
- (void)tintColorDidChange {
|
||||
// 保持你固定的颜色,忽略系统的暗淡变更
|
||||
if(_fixedTintColor != nil) [super setTintColor:_fixedTintColor];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user