悟空记账

JZSetBudgetViewController.m 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. //
  2. // JZSetBudgetViewController.m
  3. // JIZHANG
  4. //
  5. // Created by kuxuan on 2017/12/27.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "JZSetBudgetViewController.h"
  9. @interface JZSetBudgetViewController ()<UITextFieldDelegate>
  10. @end
  11. @implementation JZSetBudgetViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view.
  15. [self setupUI];
  16. [self setupNavBar];
  17. }
  18. - (void)setupNavBar {
  19. self.navTitle = @"预算设置";
  20. [self addLeftBarButtonItemWithImageName:@"mine_back" title:@"返回" target:self selector:@selector(backItemAction)];
  21. }
  22. - (void)backItemAction {
  23. [self.navigationController popViewControllerAnimated:YES];
  24. }
  25. - (void)setupUI{
  26. UILabel *setLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 200, 38)];
  27. setLabel.text = @"设置每月预算金额(元)";
  28. setLabel.textColor = [UIColor middleTitleColor];
  29. setLabel.font = FONT_SYS(14);
  30. [self.view addSubview:setLabel];
  31. UITextField *budgetTF = [[UITextField alloc]initWithFrame:CGRectMake(10, 38, SCREEN_WIDTH - 20, 60)];
  32. budgetTF.textColor = [UIColor JZColorWithHex:0x222222];
  33. budgetTF.font = FONT_SYS(30);
  34. budgetTF.delegate = self;
  35. budgetTF.tag = 888;
  36. budgetTF.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 80)];
  37. budgetTF.leftViewMode=UITextFieldViewModeAlways;
  38. budgetTF.clearButtonMode = UITextFieldViewModeWhileEditing;
  39. budgetTF.keyboardType = UIKeyboardTypeNumberPad;
  40. if (![self.budget isEqualToString:@"0.00"]) {
  41. NSString *budget = self.budget == nil ? @"3000.00":self.budget;
  42. budgetTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:budget attributes:@{NSForegroundColorAttributeName:[UIColor JZColorWithHex:0xd3d3d3]}];
  43. }else{
  44. budgetTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:@"请输入预算金额" attributes:@{NSForegroundColorAttributeName:[UIColor JZColorWithHex:0xd3d3d3]}];
  45. }
  46. budgetTF.backgroundColor = [UIColor whiteColor];
  47. [self.view addSubview:budgetTF];
  48. UIButton *saveButton = [UIButton buttonWithType:UIButtonTypeCustom];
  49. saveButton.frame = CGRectMake(15, budgetTF.frame.size.height + 100, SCREEN_WIDTH - 30, 50);
  50. [saveButton addTarget:self action:@selector(saveAction) forControlEvents:UIControlEventTouchUpInside];
  51. saveButton.cornerRadius = 8;
  52. saveButton.tag = 999;
  53. [saveButton setTitle:@"保存" forState:0];
  54. saveButton.enabled = NO;
  55. [saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  56. saveButton.backgroundColor = [UIColor JZColorWithHex:0xffc600 alpha:0.4];
  57. [self.view addSubview:saveButton];
  58. }
  59. - (void)saveAction{
  60. UITextField *tf = [self.view viewWithTag:888];
  61. NSString *urlString = [NSString stringWithFormat:@"%@/setMonthBudget",URL];
  62. [JZHttp post:urlString params:@{@"month_budget":tf.text} success:^(id json) {
  63. if (self.budgetBlock) {
  64. self.budgetBlock([NSString stringWithFormat:@"%.02f",tf.text.floatValue]);
  65. }
  66. [self.navigationController popViewControllerAnimated:YES];
  67. } failure:^(NSError *error) {
  68. }];
  69. }
  70. - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;{
  71. UIButton *saveBtn = [self.view viewWithTag:999];
  72. if (textField.text.length) {
  73. saveBtn.backgroundColor = [UIColor baseColor];
  74. saveBtn.enabled = YES;
  75. }else{
  76. saveBtn.backgroundColor = [UIColor JZColorWithHex:0xd0d0d0];
  77. saveBtn.enabled = NO;
  78. }
  79. return YES;
  80. }
  81. - (void)didReceiveMemoryWarning {
  82. [super didReceiveMemoryWarning];
  83. // Dispose of any resources that can be recreated.
  84. }
  85. /*
  86. #pragma mark - Navigation
  87. // In a storyboard-based application, you will often want to do a little preparation before navigation
  88. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  89. // Get the new view controller using [segue destinationViewController].
  90. // Pass the selected object to the new view controller.
  91. }
  92. */
  93. -(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 {
  94. NSLog(@"dxXbzHwRkrlYj");
  95. NSLog(@"W8PBLqeQHJ7FR2V9Eyjl4nTo5SZpKha1rOMu");
  96. NSLog(@"FhA2b9oqVktEX3UJu5i8BYmj1LvTKCP");
  97. NSLog(@"0nKV1JuRzAG9E");
  98. NSLog(@"kqUXfZjidHBcoJxmVIMz7usyE");
  99. NSLog(@"ISUjtcZaHFk");
  100. NSLog(@"UQ5ZXB2R7ndJ1fNw8qjzEv3TsyhtK");
  101. NSLog(@"iXat6gdwVT");
  102. NSLog(@"g5QmlFxXywzNAqID29WJcbepCMP1OBj");
  103. NSLog(@"CQ8mDeEFbqgoOuAz4VLp");
  104. NSLog(@"NVYdIqyt3LmcGgkQEBoaOUv4xAs8KiT");
  105. NSLog(@"A6PGyb3JoaZknQTrjs7hOUHYDBl8dqeFg1x9R02I");
  106. NSLog(@"leqxGX5ufy4");
  107. NSLog(@"p9nR35C8Bm0uJajwzOiPoE2");
  108. NSLog(@"lkwEaAK8Cxu02hWIeyp3zoNXvnmJUTbd");
  109. NSLog(@"4pNxsS71ZjMuLwOnEkcCQHrb");
  110. NSLog(@"vIcxe9sMFzJ45");
  111. NSLog(@"4JKisg5IR9M3XFf8dAtov2DwxQNkyH");
  112. NSLog(@"eNTwXLm6qQs");
  113. }
  114. -(void)aShCyYk7:(UIBezierPath*) aShCyYk7 a2LjNX:(UIAlertView*) a2LjNX azLd7:(UICollectionView*) azLd7 apXTEeF:(UIEvent*) apXTEeF ajsNP0Z3Wb:(UIControlEvents*) ajsNP0Z3Wb {
  115. NSLog(@"EBUFQJ1qK9uCHjDp2TNzl4WGrYVobf7ix5stc");
  116. NSLog(@"T257zSNOso");
  117. NSLog(@"hxotn5aDe2r");
  118. NSLog(@"DPVancZ9fhG8sbKJdzl15QWiuSw2YLmBHTI");
  119. NSLog(@"NHZJUwyzOt7hM8XkeWFG");
  120. NSLog(@"A5cMsNhwFyqHVCo2DbGuOKRSl41BT9t3vdjnIEz");
  121. NSLog(@"YRdISXn6MubvJtHfF91hWimj4k3DK0C");
  122. NSLog(@"z0aYuDkZBCy4KPcGWrbnE5tH");
  123. NSLog(@"vUHecqt7fz93bGMdD4");
  124. NSLog(@"7zpB69rfvG");
  125. NSLog(@"gk3Auyw6KZNMmBPehFCOo7GD");
  126. NSLog(@"eitQJFh38HTYrmCzVE6DogZqBkSGxbAjLfcK5Xa");
  127. NSLog(@"YmhsBMkKaLFO6z1yxnJo8tWu5qNPGdrXQeDREf");
  128. NSLog(@"ThDeLdPCJgM5fYa0znSUN3AHpQr8VF61oiysvOXk");
  129. NSLog(@"1AMIE0u3nm9HP");
  130. NSLog(@"w8n5lAOtrEuoIZRcNyd");
  131. NSLog(@"8eo3Y0mLyUIuk");
  132. NSLog(@"nY1kZXWldwU0Dp4SxR3mK7z2vBE5LicOHybsjC");
  133. NSLog(@"HTOXcJ7Rjv39EKbAVykCNp0Yn2lZx");
  134. }
  135. -(void)aKcGqe1My:(UISwitch*) aKcGqe1My aGJQhs54:(UICollectionView*) aGJQhs54 ashR0dO54pf:(UIRegion*) ashR0dO54pf aWFPG:(UIControlEvents*) aWFPG aq7iz3wBDJb:(UIRegion*) aq7iz3wBDJb aF627Mvi1rl:(UIBarButtonItem*) aF627Mvi1rl aKSL0aub71l:(UILabel*) aKSL0aub71l {
  136. NSLog(@"ru4FZDKe7ta1zE3Noq");
  137. NSLog(@"GEZHoncWILxae7Sh6V8uPmAKv4RUbgfj");
  138. NSLog(@"2xYNTv3QIE");
  139. NSLog(@"HJzGhIL1WkasKONePE2YvZogtxp6Qj7c5");
  140. NSLog(@"saUp72dcQIXb4t8y0Hx5gJDYRNA9ml3Bz");
  141. NSLog(@"TsE2Ai6vGSPR73oL8ZlFDUHWd");
  142. NSLog(@"TUwMIcYyp67EDW89ldfHn0");
  143. NSLog(@"MJq7BX9Qo068b4KACHljaUgDOWw3TdLmik2e5");
  144. NSLog(@"fFjG8oIHB1WCs6AayEJwxuZ34NLmpD0blvXtVMnd");
  145. NSLog(@"5x3qHk6AQZnXTJFMGpVDCRKb0");
  146. NSLog(@"kOXEzcfCwSU9njImbTiyDJ4L2oF6GYP3");
  147. NSLog(@"rm5KeGOhLa");
  148. NSLog(@"djpmtBcSRXk5Zq16C2o");
  149. NSLog(@"ZbA9hviMyjHNUSno5OJPQCKT");
  150. }
  151. @end