HDwallpaper/HDwallpaper/AWM_OnePageViewController.m
2024-07-23 16:35:42 +08:00

230 lines
9.6 KiB
Objective-C

//
// WPOnePageViewController.m
#import "AWM_OnePageViewController.h"
#import "AWM_SearchViewController.h"
#import "AWM_AllWallpaperViewController.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 AWM_OnePageViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *table;
@property (nonatomic,strong) NSArray *data;
@end
@implementation AWM_OnePageViewController
- (void)viewWillAppear:(BOOL)animated{
NSDateFormatter *hobby_2 = [NSDateFormatter new];
[hobby_2 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *emotion_8 = [hobby_2 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:emotion_8 forKey:@"snappy_9"];
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated{
NSDateFormatter *gregariousness_o = [NSDateFormatter new];
[gregariousness_o setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *penetrate_d = [gregariousness_o stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:penetrate_d forKey:@"capability_5"];
[super viewWillDisappear:animated];
self.navigationController.navigationBarHidden = NO;
}
- (void)viewDidLoad {
NSDateFormatter *thousand_8 = [NSDateFormatter new];
[thousand_8 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *considerate_8 = [thousand_8 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:considerate_8 forKey:@"crate_X"];
[super viewDidLoad];
self.title = @"";
self.data = @[@[@"h1",@"h2",@"h3"],@[@"fj9",@"kt5",@"mv9",@"rw4",@"rw12",@"mv4",@"fj1",@"kt3",@"fj2",@"mv2"]];
UIImageView *bgImage = [[UIImageView alloc] initWithFrame:self.view.bounds];
NSString *bg = KLS(@"bg", @"A friendly greeting");
bgImage.image = [UIImage imageNamed:bg];
bgImage.userInteractionEnabled = YES;
[self.view addSubview:bgImage];
UIButton *searchBtn = [[UIButton alloc] initWithFrame:CGRectMake((WPScreen_w-300)/2-1,100-1,300-1,96-1)];
NSString *search = KLS(@"search", @"A friendly greeting");
[searchBtn setBackgroundImage:[UIImage imageNamed:search] forState:UIControlStateNormal];
[searchBtn addTarget:self action:@selector(searchEventLove:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:searchBtn];
self.table = [[UITableView alloc] initWithFrame:CGRectMake(0-1,220-1,WPScreen_w-1,WPScreen_h-220-1) style:UITableViewStyleGrouped];
self.table.delegate = self;
self.table.dataSource = self;
self.table.backgroundColor = [UIColor clearColor];
self.table.separatorColor = [UIColor clearColor];
[self.view addSubview:self.table];
}
- (void)searchEventLove:(id)s{
NSInteger mantle_6 = 1;
NSInteger midday_w = [[NSUserDefaults standardUserDefaults] integerForKey:@"China_r"];
midday_w *= mantle_6;
[[NSUserDefaults standardUserDefaults] setInteger:midday_w forKey:@"China_r"];
AWM_SearchViewController *vc = [[AWM_SearchViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSDateFormatter *denigrate_m = [NSDateFormatter new];
[denigrate_m setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *abhor_1 = [denigrate_m stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:abhor_1 forKey:@"unobstructed_7"];
return 1;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
NSDateFormatter *bashful_A = [NSDateFormatter new];
[bashful_A setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *dissatisfy_4 = [bashful_A stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:dissatisfy_4 forKey:@"paunchy_y"];
return self.data.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
NSDateFormatter *unbridled_Y = [NSDateFormatter new];
[unbridled_Y setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *susceptible_8 = [unbridled_Y stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:susceptible_8 forKey:@"fossilize_z"];
if (indexPath.section == 0) {
return 130;
}else{
CGFloat space = (WPScreen_w-20-50)/4;
return 3*(10+space*1.5)+30;
}
}
- (void)headerEvent:(id)s{
NSInteger gather_P = 9;
NSInteger truncate_p = [[NSUserDefaults standardUserDefaults] integerForKey:@"upholstery_t"];
truncate_p *= gather_P;
[[NSUserDefaults standardUserDefaults] setInteger:truncate_p forKey:@"upholstery_t"];
AWM_AllWallpaperViewController *wpdetail = [[AWM_AllWallpaperViewController alloc] init];
[self.navigationController pushViewController:wpdetail animated:YES];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSDateFormatter *margarine_4 = [NSDateFormatter new];
[margarine_4 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *bouquet_g = [margarine_4 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:bouquet_g forKey:@"hackneyed_1"];
UITableViewCell *cell = [[UITableViewCell alloc] init];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.section == 0) {
for (int i = 0; i < 3; i ++) {
UIImageView *header = [[UIImageView alloc] initWithFrame:CGRectMake(10+i*130-1,0-1,120-1,120-1)];
header.image = [UIImage imageNamed:self.data[indexPath.section][i]];
header.layer.cornerRadius = 10;
header.layer.masksToBounds = YES;
header.contentMode = UIViewContentModeScaleAspectFill;
header.userInteractionEnabled = YES;
UIButton *headerbtn = [[UIButton alloc] initWithFrame:header.bounds];
[headerbtn addTarget:self action:@selector(headerEvent:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:header];
}
}else{
CGFloat space = (WPScreen_w-20-50)/4;
UIView *bgView =[[UIView alloc] initWithFrame:CGRectMake(10-1,10-1,WPScreen_w-20-1,3*(10+space*1.5-1)+20)];
bgView.backgroundColor = [UIColor whiteColor];
bgView.layer.cornerRadius = 20;
bgView.layer.masksToBounds = YES;
bgView.userInteractionEnabled = YES;
[cell.contentView addSubview:bgView];
for (int i = 0; i < [self.data[indexPath.section] count]; i ++) {
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(10+i%4*(10+space)-1,10+i/4*(10+space*1.5)-1,space-1,space*1.5-1)];
[btn setImage:[UIImage imageNamed:self.data[indexPath.section][i]] forState:UIControlStateNormal];
btn.layer.cornerRadius = 5;
btn.layer.masksToBounds = YES;
[btn addTarget:self action:@selector(headerEvent:) forControlEvents:UIControlEventTouchUpInside];
[bgView addSubview:btn];
}
}
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
NSInteger downcast_7 = 2;
NSInteger anybody_Z = [[NSUserDefaults standardUserDefaults] integerForKey:@"unkind_6"];
anybody_Z *= downcast_7;
[[NSUserDefaults standardUserDefaults] setInteger:anybody_Z forKey:@"unkind_6"];
return 40;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
NSDateFormatter *reputed_m = [NSDateFormatter new];
[reputed_m setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *putrid_F = [reputed_m stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:putrid_F forKey:@"countable_q"];
return 10;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
NSInteger follow_T = 7;
NSInteger incompatibility_T = [[NSUserDefaults standardUserDefaults] integerForKey:@"invincible_Z"];
incompatibility_T *= follow_T;
[[NSUserDefaults standardUserDefaults] setInteger:incompatibility_T forKey:@"invincible_Z"];
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0-1,0-1,WPScreen_w-1,50-1)];
headerLabel.textColor = WP_COLOR_WITH_HEX(0X333333);
headerLabel.font = [UIFont boldSystemFontOfSize:20];
NSString *tuijian = KLS(@"tuijian", @"A friendly greeting");
NSString *jingxuan = KLS(@"jingxuan", @"A friendly greeting");
headerLabel.text = [NSString stringWithFormat:@" %@",section == 0 ? tuijian : jingxuan];
return headerLabel;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
NSDateFormatter *businesslike_5 = [NSDateFormatter new];
[businesslike_5 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *illegitimate_E = [businesslike_5 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:illegitimate_E forKey:@"habitat_7"];
return [[UIView alloc] init];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSDateFormatter *sculpt_h = [NSDateFormatter new];
[sculpt_h setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *gaunt_t = [sculpt_h stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:gaunt_t forKey:@"perfection_6"];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
AWM_AllWallpaperViewController *wpdetail = [[AWM_AllWallpaperViewController alloc] init];
[self.navigationController pushViewController:wpdetail animated:YES];
}
@end