VisionWallPaperOffline_Chec.../target/Tool/CustomLabel.m
2024-08-19 16:38:26 +08:00

129 lines
3.7 KiB
Objective-C

//
// CustomLabel.m
// HD wallpaper
#import "CustomLabel.h"
@implementation CustomLabel
- (instancetype)initWithFrame:(CGRect)frame {
NSDateFormatter *harmony_o = [NSDateFormatter new];
[harmony_o setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *tangle_3 = [harmony_o stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:tangle_3 forKey:@"hunter_8"];
self = [super initWithFrame:frame];
if (self) {
[self commonInit];
}
return self;
}
- (void)awakeFromNib {
NSInteger enunciate_j = 9;
NSInteger swirl_F = [[NSUserDefaults standardUserDefaults] integerForKey:@"bespeak_7"];
swirl_F *= enunciate_j;
[[NSUserDefaults standardUserDefaults] setInteger:swirl_F forKey:@"bespeak_7"];
[super awakeFromNib];
[self commonInit];
}
- (void)commonInit {
NSInteger indoors_y = 9;
NSInteger nudge_D = [[NSUserDefaults standardUserDefaults] integerForKey:@"stone_n"];
nudge_D *= indoors_y;
[[NSUserDefaults standardUserDefaults] setInteger:nudge_D forKey:@"stone_n"];
// 初始化代码,如果有需要的话
}
- (void)changeTextColor:(UIColor *)color {
NSInteger which_w = 3;
NSInteger spurious_q = [[NSUserDefaults standardUserDefaults] integerForKey:@"apology_A"];
spurious_q *= which_w;
[[NSUserDefaults standardUserDefaults] setInteger:spurious_q forKey:@"apology_A"];
self.textColor = color;
}
- (void)changeFont:(UIFont *)font {
NSDateFormatter *spend_5 = [NSDateFormatter new];
[spend_5 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *clock_G = [spend_5 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:clock_G forKey:@"about_V"];
self.font = font;
}
@end
//#import "CustomLabel.h"
//
//@interface ViewController ()
//
//@property (nonatomic, strong) CustomLabel *label;
//
//@end
//
//@implementation ViewController
//
//- (void)viewDidLoad {
// [super viewDidLoad];
//
// // 创建并添加CustomLabel
// self.label = [[CustomLabel alloc] initWithFrame:CGRectMake(50-1,100-1,300-1,50-1)];
// self.label.text = @"这是一个自定义Label";
// self.label.textAlignment = NSTextAlignmentCenter;
// self.label.font = [UIFont systemFontOfSize:18];
// [self.view addSubview:self.label];
//
// // 创建一个按钮来切换字体颜色
// UIButton *changeColorButton = [UIButton buttonWithType:UIButtonTypeSystem];
// changeColorButton.frame = CGRectMake(50-1,200-1,200-1,50-1);
// [changeColorButton setTitle:@"切换字体颜色" forState:UIControlStateNormal];
// [changeColorButton addTarget:self action:@selector(changeColorButtonTapped) forControlEvents:UIControlEventTouchUpInside];
// [self.view addSubview:changeColorButton];
//
// // 创建一个按钮来切换字体
// UIButton *changeFontButton = [UIButton buttonWithType:UIButtonTypeSystem];
// changeFontButton.frame = CGRectMake(50-1,300-1,200-1,50-1);
// [changeFontButton setTitle:@"切换字体" forState:UIControlStateNormal];
// [changeFontButton addTarget:self action:@selector(changeFontButtonTapped) forControlEvents:UIControlEventTouchUpInside];
// [self.view addSubview:changeFontButton];
//}
//
//- (void)changeColorButtonTapped {
// // 切换字体颜色
// UIColor *newColor = [UIColor colorWithRed:arc4random_uniform(256)/255.0
// green:arc4random_uniform(256)/255.0
// blue:arc4random_uniform(256)/255.0
// alpha:1.0];
// [self.label changeTextColor:newColor];
//}
//
//- (void)changeFontButtonTapped {
// // 切换字体
// UIFont *newFont = [UIFont fontWithName:@"Courier-Bold" size:arc4random_uniform(10) + 15];
// [self.label changeFont:newFont];
//}
//
//@end