// // WPForMyViewController.m #import "WPForMyViewController.h" #import "WPwallpaperViewController.h" #import "WPUserPravcyVC.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]; } UIButton *pracy_btn = [UIButton new]; [self.view addSubview:pracy_btn]; [pracy_btn addTarget:self action:@selector(showUserPravcy) forControlEvents:UIControlEventTouchUpInside]; [pracy_btn setTitle:@"隐私政策" forState:UIControlStateNormal]; [pracy_btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; pracy_btn.titleLabel.font = [UIFont systemFontOfSize:14]; CGFloat btn_w = 90; CGFloat btn_h = 20; pracy_btn.frame = CGRectMake((WPScreen_w - btn_w) * .5, WPScreen_h - btn_h - 90, btn_w, btn_h); } //显示用户隐私 - (void)showUserPravcy { WPUserPravcyVC *vc = [WPUserPravcyVC new]; [self.navigationController pushViewController:vc animated:YES]; } - (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