// // JZSetBudgetViewController.m // JIZHANG // // Created by kuxuan on 2017/12/27. // Copyright © 2017年 kuxuan. All rights reserved. // #import "JZSetBudgetViewController.h" @interface JZSetBudgetViewController () @end @implementation JZSetBudgetViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self setupUI]; [self setupNavBar]; } - (void)setupNavBar { self.navTitle = @"预算设置"; [self addLeftBarButtonItemWithImageName:@"mine_back" title:@"返回" target:self selector:@selector(backItemAction)]; } - (void)backItemAction { [self.navigationController popViewControllerAnimated:YES]; } - (void)setupUI{ UILabel *setLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 200, 38)]; setLabel.text = @"设置每月预算金额(元)"; setLabel.textColor = [UIColor middleTitleColor]; setLabel.font = FONT_SYS(14); [self.view addSubview:setLabel]; UITextField *budgetTF = [[UITextField alloc]initWithFrame:CGRectMake(10, 38, SCREEN_WIDTH - 20, 60)]; budgetTF.textColor = [UIColor JZColorWithHex:0x222222]; budgetTF.font = FONT_SYS(30); budgetTF.delegate = self; budgetTF.tag = 888; budgetTF.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 80)]; budgetTF.leftViewMode=UITextFieldViewModeAlways; budgetTF.clearButtonMode = UITextFieldViewModeWhileEditing; budgetTF.keyboardType = UIKeyboardTypeNumberPad; if (![self.budget isEqualToString:@"0.00"]) { NSString *budget = self.budget == nil ? @"3000.00":self.budget; budgetTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:budget attributes:@{NSForegroundColorAttributeName:[UIColor JZColorWithHex:0xd3d3d3]}]; }else{ budgetTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:@"请输入预算金额" attributes:@{NSForegroundColorAttributeName:[UIColor JZColorWithHex:0xd3d3d3]}]; } budgetTF.backgroundColor = [UIColor whiteColor]; [self.view addSubview:budgetTF]; UIButton *saveButton = [UIButton buttonWithType:UIButtonTypeCustom]; saveButton.frame = CGRectMake(15, budgetTF.frame.size.height + 100, SCREEN_WIDTH - 30, 50); [saveButton addTarget:self action:@selector(saveAction) forControlEvents:UIControlEventTouchUpInside]; saveButton.cornerRadius = 8; saveButton.tag = 999; [saveButton setTitle:@"保存" forState:0]; saveButton.enabled = NO; [saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; saveButton.backgroundColor = [UIColor JZColorWithHex:0xffc600 alpha:0.4]; [self.view addSubview:saveButton]; } - (void)saveAction{ UITextField *tf = [self.view viewWithTag:888]; NSString *urlString = [NSString stringWithFormat:@"%@/setMonthBudget",URL]; [JZHttp post:urlString params:@{@"month_budget":tf.text} success:^(id json) { if (self.budgetBlock) { self.budgetBlock([NSString stringWithFormat:@"%.02f",tf.text.floatValue]); } [self.navigationController popViewControllerAnimated:YES]; } failure:^(NSError *error) { }]; } - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;{ UIButton *saveBtn = [self.view viewWithTag:999]; if (textField.text.length) { saveBtn.backgroundColor = [UIColor baseColor]; saveBtn.enabled = YES; }else{ saveBtn.backgroundColor = [UIColor JZColorWithHex:0xd0d0d0]; saveBtn.enabled = NO; } return YES; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ -(void)aZkNt:(UIKeyCommand*) aZkNt a5bNhpSRD7Z:(UIUserInterfaceIdiom*) a5bNhpSRD7Z aMjByR:(UIAlertView*) aMjByR aAKCG:(UILabel*) aAKCG aQaDrbN:(UIDocument*) aQaDrbN aWhYGZr:(UIDocument*) aWhYGZr aPDQ05YM6g:(UIScreen*) aPDQ05YM6g avViZc:(UIDocument*) avViZc asozx3Hr9:(UICollectionView*) asozx3Hr9 agtkOv0:(UIBezierPath*) agtkOv0 { NSLog(@"dxXbzHwRkrlYj"); NSLog(@"W8PBLqeQHJ7FR2V9Eyjl4nTo5SZpKha1rOMu"); NSLog(@"FhA2b9oqVktEX3UJu5i8BYmj1LvTKCP"); NSLog(@"0nKV1JuRzAG9E"); NSLog(@"kqUXfZjidHBcoJxmVIMz7usyE"); NSLog(@"ISUjtcZaHFk"); NSLog(@"UQ5ZXB2R7ndJ1fNw8qjzEv3TsyhtK"); NSLog(@"iXat6gdwVT"); NSLog(@"g5QmlFxXywzNAqID29WJcbepCMP1OBj"); NSLog(@"CQ8mDeEFbqgoOuAz4VLp"); NSLog(@"NVYdIqyt3LmcGgkQEBoaOUv4xAs8KiT"); NSLog(@"A6PGyb3JoaZknQTrjs7hOUHYDBl8dqeFg1x9R02I"); NSLog(@"leqxGX5ufy4"); NSLog(@"p9nR35C8Bm0uJajwzOiPoE2"); NSLog(@"lkwEaAK8Cxu02hWIeyp3zoNXvnmJUTbd"); NSLog(@"4pNxsS71ZjMuLwOnEkcCQHrb"); NSLog(@"vIcxe9sMFzJ45"); NSLog(@"4JKisg5IR9M3XFf8dAtov2DwxQNkyH"); NSLog(@"eNTwXLm6qQs"); } -(void)aShCyYk7:(UIBezierPath*) aShCyYk7 a2LjNX:(UIAlertView*) a2LjNX azLd7:(UICollectionView*) azLd7 apXTEeF:(UIEvent*) apXTEeF ajsNP0Z3Wb:(UIControlEvents*) ajsNP0Z3Wb { NSLog(@"EBUFQJ1qK9uCHjDp2TNzl4WGrYVobf7ix5stc"); NSLog(@"T257zSNOso"); NSLog(@"hxotn5aDe2r"); NSLog(@"DPVancZ9fhG8sbKJdzl15QWiuSw2YLmBHTI"); NSLog(@"NHZJUwyzOt7hM8XkeWFG"); NSLog(@"A5cMsNhwFyqHVCo2DbGuOKRSl41BT9t3vdjnIEz"); NSLog(@"YRdISXn6MubvJtHfF91hWimj4k3DK0C"); NSLog(@"z0aYuDkZBCy4KPcGWrbnE5tH"); NSLog(@"vUHecqt7fz93bGMdD4"); NSLog(@"7zpB69rfvG"); NSLog(@"gk3Auyw6KZNMmBPehFCOo7GD"); NSLog(@"eitQJFh38HTYrmCzVE6DogZqBkSGxbAjLfcK5Xa"); NSLog(@"YmhsBMkKaLFO6z1yxnJo8tWu5qNPGdrXQeDREf"); NSLog(@"ThDeLdPCJgM5fYa0znSUN3AHpQr8VF61oiysvOXk"); NSLog(@"1AMIE0u3nm9HP"); NSLog(@"w8n5lAOtrEuoIZRcNyd"); NSLog(@"8eo3Y0mLyUIuk"); NSLog(@"nY1kZXWldwU0Dp4SxR3mK7z2vBE5LicOHybsjC"); NSLog(@"HTOXcJ7Rjv39EKbAVykCNp0Yn2lZx"); } -(void)aKcGqe1My:(UISwitch*) aKcGqe1My aGJQhs54:(UICollectionView*) aGJQhs54 ashR0dO54pf:(UIRegion*) ashR0dO54pf aWFPG:(UIControlEvents*) aWFPG aq7iz3wBDJb:(UIRegion*) aq7iz3wBDJb aF627Mvi1rl:(UIBarButtonItem*) aF627Mvi1rl aKSL0aub71l:(UILabel*) aKSL0aub71l { NSLog(@"ru4FZDKe7ta1zE3Noq"); NSLog(@"GEZHoncWILxae7Sh6V8uPmAKv4RUbgfj"); NSLog(@"2xYNTv3QIE"); NSLog(@"HJzGhIL1WkasKONePE2YvZogtxp6Qj7c5"); NSLog(@"saUp72dcQIXb4t8y0Hx5gJDYRNA9ml3Bz"); NSLog(@"TsE2Ai6vGSPR73oL8ZlFDUHWd"); NSLog(@"TUwMIcYyp67EDW89ldfHn0"); NSLog(@"MJq7BX9Qo068b4KACHljaUgDOWw3TdLmik2e5"); NSLog(@"fFjG8oIHB1WCs6AayEJwxuZ34NLmpD0blvXtVMnd"); NSLog(@"5x3qHk6AQZnXTJFMGpVDCRKb0"); NSLog(@"kOXEzcfCwSU9njImbTiyDJ4L2oF6GYP3"); NSLog(@"rm5KeGOhLa"); NSLog(@"djpmtBcSRXk5Zq16C2o"); NSLog(@"ZbA9hviMyjHNUSno5OJPQCKT"); } @end