From b106e6088078fea33e13df96972032d5e088ec48 Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Sat, 27 Jul 2024 12:45:08 +0800 Subject: [PATCH] add switch for attachWatermark --- .../ViewControllers/MainFrameViewController.m | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index e820563e..5ee0673c 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -1004,28 +1004,30 @@ static NSMutableSet* hostList; - (void)attachWaterMark { // Create and configure the label - [self->waterMark removeFromSuperview]; - self->waterMark = [[UILabel alloc] init]; - self->waterMark.translatesAutoresizingMaskIntoConstraints = NO; - self->waterMark.text = [LocalizationHelper localizedStringForKey:@"Modified by: True砖家 on Bilibili"]; - self->waterMark.textColor = UIColor.blackColor; - self->waterMark.alpha = 0.2; - self->waterMark.font = [UIFont systemFontOfSize:20]; - self->waterMark.textAlignment = NSTextAlignmentCenter; - self->waterMark.backgroundColor = [UIColor clearColor]; - self->waterMark.userInteractionEnabled = YES; // Enable user interaction for tap gesture - // Add tap gesture recognizer to handle hyperlink action - UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(waterMarkTapped)]; - [self->waterMark addGestureRecognizer:tapGesture]; - // Add the label to the view hierarchy - [self.view addSubview:self->waterMark]; - // Set up constraints - [NSLayoutConstraint activateConstraints:@[ - [self->waterMark.centerXAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-250], // Aligns the horizontal center of label to the horizontal center of view - [self->waterMark.centerYAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:-50], // Aligns the vertical center of label to the vertical center of view - [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 - ]]; + if(true){ + [self->waterMark removeFromSuperview]; + self->waterMark = [[UILabel alloc] init]; + self->waterMark.translatesAutoresizingMaskIntoConstraints = NO; + self->waterMark.text = [LocalizationHelper localizedStringForKey:@"Modified by: True砖家 on Bilibili"]; + self->waterMark.textColor = UIColor.blackColor; + self->waterMark.alpha = 0.2; + self->waterMark.font = [UIFont systemFontOfSize:20]; + self->waterMark.textAlignment = NSTextAlignmentCenter; + self->waterMark.backgroundColor = [UIColor clearColor]; + self->waterMark.userInteractionEnabled = YES; // Enable user interaction for tap gesture + // Add tap gesture recognizer to handle hyperlink action + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(waterMarkTapped)]; + [self->waterMark addGestureRecognizer:tapGesture]; + // Add the label to the view hierarchy + [self.view addSubview:self->waterMark]; + // Set up constraints + [NSLayoutConstraint activateConstraints:@[ + [self->waterMark.centerXAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-250], // Aligns the horizontal center of label to the horizontal center of view + [self->waterMark.centerYAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:-50], // Aligns the vertical center of label to the vertical center of view + [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{