VisionWallPaperOffline-8-19/HD wallpaper/WPForMyViewController.m
2024-07-03 14:33:32 +08:00

49 lines
1.9 KiB
Objective-C

//
// WPForMyViewController.m
#import "WPForMyViewController.h"
#import "WPwallpaperViewController.h"
#define WPScreen_w [UIScreen mainScreen].bounds.size.width
#define WPScreen_h [UIScreen mainScreen].bounds.size.height
#define WP_COLOR_WITH_HEX(HEX) [UIColor colorWithRed:((HEX >> 16) & 0xFF) / 255.0f green:((HEX >> 8) & 0xFF) / 255.0f blue:((HEX) & 0xFF) / 255.0f alpha:1.0f]
@interface WPForMyViewController ()
@end
@implementation WPForMyViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *bgImage = [[UIImageView alloc] initWithFrame:self.view.bounds];
bgImage.image = [UIImage imageNamed:@"bg"];
bgImage.userInteractionEnabled = YES;
[self.view addSubview:bgImage];
UIImageView *iconImage = [[UIImageView alloc] initWithFrame:CGRectMake((WPScreen_w-150)/2, 150, 150, 150)];
iconImage.image = [UIImage imageNamed:@"my0"];
iconImage.userInteractionEnabled = YES;
[self.view addSubview:iconImage];
NSArray *icons = @[@"my1",@"my2",@"my3",@"my4"];
for (int i = 0; i < 4; i ++) {
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake((WPScreen_w-280)/2+i%2*(150), 350+i/2*(150), 130, 130)];
[btn setImage:[UIImage imageNamed:icons[i]] forState:UIControlStateNormal];
// btn.layer.cornerRadius = 5;
// btn.layer.masksToBounds = YES;
btn.tag = i;
[btn addTarget:self action:@selector(iconEvent:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
}
- (void)iconEvent:(UIButton *)icon{
if (icon.tag == 0) {
WPwallpaperViewController *wpdetail = [[WPwallpaperViewController alloc] init];
[self.navigationController pushViewController:wpdetail animated:YES];
}else if (icon.tag == 2){
UIAlertView *iconAl = [[UIAlertView alloc] initWithTitle:@"" message:@"Clean Success" delegate:self cancelButtonTitle:nil otherButtonTitles:@"ok", nil];
[iconAl show];
}
}
@end