add switch for attachWatermark

This commit is contained in:
True Zhuanjia committed 2024-07-27 12:45:08 +08:00
1 parent 81c04bc2b2
commit b106e60880
1 file changed
+24 -22
@@ -1004,28 +1004,30 @@ static NSMutableSet* hostList;
- (void)attachWaterMark { - (void)attachWaterMark {
// Create and configure the label // Create and configure the label
[self->waterMark removeFromSuperview]; if(true){
self->waterMark = [[UILabel alloc] init]; [self->waterMark removeFromSuperview];
self->waterMark.translatesAutoresizingMaskIntoConstraints = NO; self->waterMark = [[UILabel alloc] init];
self->waterMark.text = [LocalizationHelper localizedStringForKey:@"Modified by: True砖家 on Bilibili"]; self->waterMark.translatesAutoresizingMaskIntoConstraints = NO;
self->waterMark.textColor = UIColor.blackColor; self->waterMark.text = [LocalizationHelper localizedStringForKey:@"Modified by: True砖家 on Bilibili"];
self->waterMark.alpha = 0.2; self->waterMark.textColor = UIColor.blackColor;
self->waterMark.font = [UIFont systemFontOfSize:20]; self->waterMark.alpha = 0.2;
self->waterMark.textAlignment = NSTextAlignmentCenter; self->waterMark.font = [UIFont systemFontOfSize:20];
self->waterMark.backgroundColor = [UIColor clearColor]; self->waterMark.textAlignment = NSTextAlignmentCenter;
self->waterMark.userInteractionEnabled = YES; // Enable user interaction for tap gesture self->waterMark.backgroundColor = [UIColor clearColor];
// Add tap gesture recognizer to handle hyperlink action self->waterMark.userInteractionEnabled = YES; // Enable user interaction for tap gesture
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(waterMarkTapped)]; // Add tap gesture recognizer to handle hyperlink action
[self->waterMark addGestureRecognizer:tapGesture]; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(waterMarkTapped)];
// Add the label to the view hierarchy [self->waterMark addGestureRecognizer:tapGesture];
[self.view addSubview:self->waterMark]; // Add the label to the view hierarchy
// Set up constraints [self.view addSubview:self->waterMark];
[NSLayoutConstraint activateConstraints:@[ // Set up constraints
[self->waterMark.centerXAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-250], // Aligns the horizontal center of label to the horizontal center of view [NSLayoutConstraint activateConstraints:@[
[self->waterMark.centerYAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:-50], // Aligns the vertical center of label to the vertical center of view [self->waterMark.centerXAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-250], // Aligns the horizontal center of label to the horizontal center of view
[self->waterMark.widthAnchor constraintEqualToConstant:500], // Sets the width of label to 200 points [self->waterMark.centerYAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:-50], // Aligns the vertical center of label to the vertical center of view
[self->waterMark.heightAnchor constraintEqualToConstant:60] // Sets the height of label to 50 points [self->waterMark.widthAnchor constraintEqualToConstant:500], // Sets the width of label to 200 points
]]; [self->waterMark.heightAnchor constraintEqualToConstant:60] // Sets the height of label to 50 points
]];
}
} }
- (bool)isIphone{ - (bool)isIphone{