悟空记账

JZAwokeViewController.m 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. //
  2. // JZAwokeViewController.m
  3. // JIZHANG
  4. //
  5. // Created by jikaipeng on 2017/10/19.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "JZAwokeViewController.h"
  9. #import "JZAwokePickViewController.h"
  10. @interface JZAwokeViewController ()<UITableViewDelegate,UITableViewDataSource>
  11. @property (nonatomic, strong) UITableView *tableview;
  12. @property (nonatomic, strong) JZAwokePickViewController *pickVC;
  13. @property (nonatomic, strong) NSMutableArray *dataList;
  14. @end
  15. @implementation JZAwokeViewController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. // Do any additional setup after loading the view.
  19. [self setNavigation];
  20. self.navigationController.navigationBar.hidden = NO;
  21. self.navTitle = @"提醒设置";
  22. self.tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT-70) style:UITableViewStylePlain];
  23. self.tableview.backgroundColor = [UIColor lineColor];
  24. self.view.backgroundColor = [UIColor lineColor];
  25. self.tableview.delegate = self;
  26. self.tableview.dataSource = self;
  27. self.tableview.tableFooterView = [[UIView alloc]init];
  28. [self.tableview setSeparatorColor:[UIColor lineColor]];
  29. UIButton *footBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  30. footBtn.backgroundColor = [UIColor whiteColor];
  31. [footBtn setTitle:@"+ 添加提醒" forState:UIControlStateNormal];
  32. [footBtn setTitleColor:[UIColor titleColor] forState:UIControlStateNormal];
  33. [footBtn addTarget:self action:@selector(addAction) forControlEvents:UIControlEventTouchUpInside];
  34. [self.view addSubview:self.tableview];
  35. self.pickVC = [[JZAwokePickViewController alloc] init];
  36. [self.view addSubview:self.pickVC];
  37. __weak typeof(self)weakSelf = self;
  38. self.pickVC.returnDatalist = ^(NSMutableArray *datalist) {
  39. weakSelf.dataList = datalist;
  40. [weakSelf.tableview reloadData];
  41. };
  42. [self.view addSubview:footBtn];
  43. [footBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.left.equalTo(weakSelf.view.mas_left);
  45. make.right.equalTo(weakSelf.view.mas_right);
  46. make.bottom.equalTo(weakSelf.view.mas_bottom);
  47. make.height.equalTo(@50);
  48. }];
  49. }
  50. - (void)viewWillAppear:(BOOL)animated{
  51. [super viewWillAppear:animated];
  52. [self.tableview reloadData];
  53. }
  54. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  55. return self.dataList.count;
  56. }
  57. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  58. UITableViewCell *cell = [[UITableViewCell alloc]init];
  59. cell.backgroundColor = [UIColor whiteColor];
  60. cell.textLabel.text = @"提醒时间";
  61. cell.textLabel.textColor = [UIColor middleTitleColor];
  62. cell.textLabel.font = FONT_SYS(14);
  63. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  64. UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 40)];
  65. label.text = self.dataList[indexPath.row];
  66. label.textColor = [UIColor middleTitleColor];
  67. label.font = FONT_SYS(14);
  68. cell.accessoryView = label;
  69. return cell;
  70. }
  71. - (void)addAction{
  72. self.pickVC.alpha = 1;
  73. }
  74. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
  75. return YES;
  76. }
  77. - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
  78. return UITableViewCellEditingStyleDelete;
  79. }
  80. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  81. {
  82. [tableView setEditing:NO animated:YES];
  83. NSString *string = self.dataList[indexPath.row];
  84. if (editingStyle == UITableViewCellEditingStyleDelete) {
  85. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"你确定删除该提醒?" preferredStyle:UIAlertControllerStyleAlert];
  86. [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
  87. [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  88. [self.dataList removeObjectAtIndex:indexPath.row];
  89. [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
  90. [[NSUserDefaults standardUserDefaults] setObject:self.dataList forKey: @"JZAwokeData"];
  91. //取消特定一条本地通知,使用附带的userInfo来确定某一条
  92. NSArray *arrLocalNotifis = [[UIApplication sharedApplication] scheduledLocalNotifications];//获取所有本地通知
  93. for (UILocalNotification *localNoti in arrLocalNotifis)//遍历
  94. {
  95. NSDictionary *userInfo = localNoti.userInfo;//获取通知附带的信息
  96. if (userInfo)
  97. {
  98. if (arrLocalNotifis.count>0)
  99. {
  100. // 遍历找到对应nfkey和notificationtag的通知
  101. for (int i=0; i<arrLocalNotifis.count; i++)
  102. {
  103. UILocalNotification *myUILocalNotification = [arrLocalNotifis objectAtIndex:i];
  104. NSDictionary *userInfo = myUILocalNotification.userInfo;
  105. NSString *obj = [userInfo objectForKey:@"name"];
  106. if ([obj isEqualToString:string])
  107. {
  108. // 删除本地通知
  109. [[UIApplication sharedApplication] cancelLocalNotification:myUILocalNotification];
  110. break;
  111. }
  112. }
  113. }
  114. }
  115. }
  116. }]];
  117. [self presentViewController:alertController animated:YES completion:nil];
  118. }
  119. }
  120. - (NSMutableArray *)dataList{
  121. if (!_dataList) {
  122. _dataList = [NSMutableArray array];
  123. NSArray *arrLocalNotifis = [[UIApplication sharedApplication] scheduledLocalNotifications];
  124. for (UILocalNotification *localNoti in arrLocalNotifis)//遍历
  125. {
  126. NSDictionary *userInfo = localNoti.userInfo;
  127. if (userInfo) {
  128. NSString *obj = [userInfo objectForKey:@"name"];
  129. [_dataList addObject:obj];
  130. }
  131. }
  132. }
  133. return _dataList;
  134. }
  135. - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{
  136. return @"删除";
  137. }
  138. //设置进入编辑状态时,cell不会缩进
  139. - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath{
  140. return NO;
  141. }
  142. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  143. [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
  144. }
  145. - (void)setNavigation{
  146. [self addLeftBarButtonItemWithImageName:@"mine_back" title:@"返回" target:self selector:@selector(backAction)];
  147. }
  148. - (void)backAction{
  149. [self.navigationController popViewControllerAnimated:YES];
  150. }
  151. - (void)didReceiveMemoryWarning {
  152. [super didReceiveMemoryWarning];
  153. // Dispose of any resources that can be recreated.
  154. }
  155. -(void)aYZMm4hqxaw:(UITableView*) aYZMm4hqxaw ade2Px:(UIFont*) ade2Px ajRlFIYp:(UIActivity*) ajRlFIYp adZ6Nfb:(UIApplication*) adZ6Nfb aSlRi:(UIEdgeInsets*) aSlRi aSOUjp9LGf:(UIViewController*) aSOUjp9LGf a0Z5qOsk:(UIViewController*) a0Z5qOsk aM8dBcRQY:(UIView*) aM8dBcRQY a3aJiOkY:(UIBarButtonItem*) a3aJiOkY aauC3lQyiI:(UIVisualEffectView*) aauC3lQyiI aGHZmi:(UIWindow*) aGHZmi aEodJ7yPZA:(UIFont*) aEodJ7yPZA aUrif:(UIControl*) aUrif aUvPNjApG:(UIBarButtonItem*) aUvPNjApG aLVbGJU:(UIDevice*) aLVbGJU aSYJcCZ57:(UIBarButtonItem*) aSYJcCZ57 auWTVsHMpwK:(UIMenuItem*) auWTVsHMpwK aakQInNK1tD:(UIApplication*) aakQInNK1tD ajNdU4:(UIVisualEffectView*) ajNdU4 aesNE5:(UILabel*) aesNE5 {
  156. NSLog(@"sPQ5Lv4EqaXbeHx8n30OM");
  157. NSLog(@"Ofd9XaA7FtG");
  158. NSLog(@"RlOx0irqwH");
  159. NSLog(@"3MzZHuOElUiqTdmLrIpneNjPXRKWY6vQoyBx2GF");
  160. NSLog(@"WYdL14fV8gF2KH7kuzqD");
  161. NSLog(@"poEYzUHFuqJ0x173");
  162. NSLog(@"2SoyYQEg7fjun3lKapRWZHe5qDvUVCtFxhAsNMPm");
  163. NSLog(@"H3EYLgqdS76PiOwmBphaDxGX2b");
  164. NSLog(@"lsbGNHWotUqPMpf2ngdSA0mcR7K1X5wyOY8");
  165. NSLog(@"x0uMdz1bAKW4gwVZmGsHnDRPhTrp");
  166. }
  167. -(void)aX1prNyYdJ0:(UIInputView*) aX1prNyYdJ0 ax9SYd63s:(UISwitch*) ax9SYd63s aFev1:(UIEvent*) aFev1 aOxMhHT:(UICollectionView*) aOxMhHT aFSJE:(UIControlEvents*) aFSJE aULNPt0s:(UIImage*) aULNPt0s apmNjhzV6:(UIFont*) apmNjhzV6 aweskHGJaQ:(UISearchBar*) aweskHGJaQ a5VfD8:(UIColor*) a5VfD8 a2hCLY4AtM:(UISearchBar*) a2hCLY4AtM aUI8LJ:(UIWindow*) aUI8LJ a2dzOI8:(UISwitch*) a2dzOI8 aarLzvm:(UIActivity*) aarLzvm {
  168. NSLog(@"izjXncUroNydqQIGR5uCklKT7SEBVavHAp3s");
  169. NSLog(@"twzkdeK8nEHOqfg5S9YrlMp4hsRUWcNZXu2I");
  170. NSLog(@"KrO0uZ6EqdBj1XhHFUvVzxtPCgG9NeWIQ3RTcnlp");
  171. NSLog(@"t95dlTrioWpf6X0skOILKw");
  172. NSLog(@"nVBs6RMJzWuY");
  173. NSLog(@"YCP408MiEaFhx");
  174. NSLog(@"W7CLAlZPwR64EuibpqsmetcBMofKjvOXy");
  175. NSLog(@"NWJTV3hxUsGu0FZL");
  176. NSLog(@"0tu9iIaqbpT1POXjoeWnLmrU87ZcAC");
  177. NSLog(@"7LWqZa3D8xKk");
  178. NSLog(@"WqoeFAHlLnxYZ2rBkP9bwujdD");
  179. NSLog(@"aLcq0tV3gsySzK");
  180. NSLog(@"qQW1AvJIymt5YalfTOChzVwB6bge2kNM3nSGr");
  181. NSLog(@"5qitcH0I28MYyWNr9jge3ZxsFDAC");
  182. NSLog(@"zZwxOoqHVFXQJGLnjcER");
  183. NSLog(@"xBhwS3yvjCqac");
  184. }
  185. -(void)aQtvsuRBA:(UIControl*) aQtvsuRBA aPZcdjO2Q:(UIImageView*) aPZcdjO2Q ag27UN:(UIImageView*) ag27UN aiIhSonJk1g:(UIMenuItem*) aiIhSonJk1g aPUKR8ySesv:(UIColor*) aPUKR8ySesv aTtyrm:(UIEvent*) aTtyrm ateXBxGKU9:(UIMotionEffect*) ateXBxGKU9 aIEFP9xJm:(UIScreen*) aIEFP9xJm aX3utwYU:(UIEvent*) aX3utwYU adINMyp:(UIKeyCommand*) adINMyp ajPqHAe7d9:(UIApplication*) ajPqHAe7d9 a1QVrxcL:(UITableView*) a1QVrxcL alzJajE:(UIBezierPath*) alzJajE {
  186. NSLog(@"0TSebB4mD2ZQifWd8t");
  187. NSLog(@"EqmQzuwTA5K6vGcpd");
  188. NSLog(@"foCOLR53JwAUHs1kbuSNY4Mirleqj9QPn");
  189. NSLog(@"lZebFKzUxWTBnCicRMryt2H84odmOIAD17aP5g");
  190. NSLog(@"ad8wAvCDO3brKkhTPFQtLJxyj4ZqfzmVcYM6Xp");
  191. NSLog(@"LRGhXeuIp5gcywoH2qNY1PAvVUSF7i");
  192. NSLog(@"1UTYZEloP5zA");
  193. NSLog(@"2tq7wCkGSux");
  194. NSLog(@"U7L3Pgd6AE9BMFVylXZJcv");
  195. NSLog(@"fA7Mwj2eyIBFlQcuN80C9EdYUPL1m4sVDiaT5R");
  196. NSLog(@"MpuirXl7ZbBUSh49PT2Iq13tsze5YRcg8wad6fjF");
  197. NSLog(@"3OUNZ41GyQ6mar8KMuE");
  198. NSLog(@"xrwK56l4eGhSoUROE");
  199. NSLog(@"BtP8z9qMhJmen27cg316xivkpGLI");
  200. NSLog(@"ULShZ39jGtOAMn5D4HRvcJaEkrWmQlV2Ff178Ks");
  201. NSLog(@"S6DcrCfgBYQx0Hnl52iwWFOytZ948mbjkzuIqJK");
  202. }
  203. -(void)aJCWN:(UIImageView*) aJCWN aLoyA:(UIBarButtonItem*) aLoyA aCr6Up2xX:(UIEvent*) aCr6Up2xX a1aVA:(UICollectionView*) a1aVA aZw0R:(UIControl*) aZw0R a6QHzlJ:(UIBezierPath*) a6QHzlJ aL764:(UILabel*) aL764 a5AOIq9:(UIControl*) a5AOIq9 aLCsJ:(UIEdgeInsets*) aLCsJ aOt4c6:(UITableView*) aOt4c6 aQRnH:(UIBarButtonItem*) aQRnH aRngbw61:(UIVisualEffectView*) aRngbw61 a7m5D:(UIActivity*) a7m5D avFqozIy9U:(UIImage*) avFqozIy9U {
  204. NSLog(@"ab6Jqwf7gIKp2zUk9niF8sXLMtSDh4WQ3G1P");
  205. NSLog(@"S1lfKuovzg9Ii");
  206. NSLog(@"AaRghqDPbZ85Eer4nwOJ");
  207. NSLog(@"oRl3qIEadx0zug");
  208. NSLog(@"XA2NKGfgBxM5YD0k");
  209. NSLog(@"PAOiovRacFHuxK3Z8fzLGDJyUqBl7nbY");
  210. NSLog(@"3UK09Yba2y8BQeE5gfkMcuLDPqFSdpz6");
  211. NSLog(@"Hhr20RkPUMpxqJXFZ8oiOfbEQ7A9");
  212. NSLog(@"mNzwunSJbFM0ZfxXA4HyikIpO");
  213. NSLog(@"McboIGHARwe7V");
  214. NSLog(@"PItxypXVBHgdaAn54KwmJvc8");
  215. NSLog(@"Jw0SZuhfCFOp5RztGNi9mdo1jkET2UvBYlMcbn");
  216. NSLog(@"rEk9VqXaPs5hYm1BgIzAodQRij");
  217. NSLog(@"clyJfMFXnVwEAGDCSax62uOHBTrYdkIQN");
  218. NSLog(@"ZzW6UvuGXCj");
  219. }
  220. -(void)aNCeAtUkYz:(UIControl*) aNCeAtUkYz aN562OPKej:(UILabel*) aN562OPKej aSuR5Y:(UIImageView*) aSuR5Y aYRZuI82Ey:(UIFontWeight*) aYRZuI82Ey aYv6GrfEhc:(UIDocument*) aYv6GrfEhc aLyn9gxm0MN:(UIInputView*) aLyn9gxm0MN aqu4P:(UISwitch*) aqu4P axQPMZYq:(UIBarButtonItem*) axQPMZYq afKSa:(UIView*) afKSa aLcTeavRM:(UIRegion*) aLcTeavRM {
  221. NSLog(@"TvSWDJIgGZyd9XL3O7");
  222. NSLog(@"HvkIAqmCjTD2FRs4le5Xp");
  223. NSLog(@"nPm2LtES96JhcvDGUNByZuHTCQMdq74lO");
  224. NSLog(@"b8zsC7U1gGP65QwxBRLolr4dIDT0fVmkE");
  225. NSLog(@"MwbexTZIfEroCAUlVqW");
  226. NSLog(@"zd9DKMsOIeSTpkBmAGV");
  227. NSLog(@"awPdjlI43AhZvOqEGuUi9XDLrY");
  228. NSLog(@"keS0PLv4Cb6wuDKEyzMph2fNmGsVYaOjHJq9");
  229. NSLog(@"zxvw7fpJd9rboN5ZRyHlL48iCWeu6Qs0aX2TO");
  230. NSLog(@"5ifzYr2WgIxoA");
  231. NSLog(@"JHglNidqtkR7X9MeZmrYv");
  232. NSLog(@"KAzC0f6vaG4mokTL9Y5WVJDw8QRygH1MhZqXeltn");
  233. NSLog(@"R27sBMypSdDeXWlFIjPu3");
  234. NSLog(@"zYgA2e3TNO4DGBtjqIX");
  235. }
  236. -(void)aaR59cX68ij:(UIEdgeInsets*) aaR59cX68ij aNyFGWpJfU:(UIImageView*) aNyFGWpJfU a3K4doO:(UILabel*) a3K4doO aS63CO:(UIVisualEffectView*) aS63CO abFltuMs:(UIEdgeInsets*) abFltuMs aXPtZL5B:(UIEdgeInsets*) aXPtZL5B aLDmdHighk8:(UILabel*) aLDmdHighk8 arBA2:(UIRegion*) arBA2 aQaH8v:(UITableView*) aQaH8v {
  237. NSLog(@"o1EQXz2jiwvPFYuk6K0sZ5hRgUHrcLq9G7mSC");
  238. NSLog(@"UiHDmKOAzSFfX7gduwa");
  239. NSLog(@"vJSRZEezDLY8P7crV");
  240. NSLog(@"6Chxoa1DpPMgwsQc8SITNr0AVHby4RKuB5lEemZ");
  241. NSLog(@"fpi26dOxLsrvcJ5zyQ4U7oCnal1GVF");
  242. NSLog(@"C0xjY8MOovVkdUgHus6q");
  243. NSLog(@"RNyMmhZsj0zr3XwGfVgp1kPDe");
  244. NSLog(@"Y8QDKPiqoyvN0dVaswhXj5bMfAUuFn7eZk9z");
  245. NSLog(@"rXaqsHpF6ovhUOe273jSzBiu0yRktClVgP");
  246. NSLog(@"OCWk2Aguxyif");
  247. NSLog(@"Xl319SBfoYnrqs7TVbt");
  248. NSLog(@"tSMlOxFqIY0PnhNC8jbsU");
  249. }
  250. -(void)anPsZHj:(UIEvent*) anPsZHj aYKh3k:(UIControl*) aYKh3k aRN1y:(UIScreen*) aRN1y aHPRdbkcqLf:(UITableView*) aHPRdbkcqLf aCMxy3:(UIUserInterfaceIdiom*) aCMxy3 azrMFCGg:(UIVisualEffectView*) azrMFCGg asdiT0tA:(UIButton*) asdiT0tA aK6l4efz:(UIViewController*) aK6l4efz aFxUC478W:(UIBarButtonItem*) aFxUC478W aCs6pZO2:(UIBezierPath*) aCs6pZO2 aN9OLIYFQzR:(UIEvent*) aN9OLIYFQzR aiSD1:(UILabel*) aiSD1 {
  251. NSLog(@"unvx9UliAj20DbSgVGEKPkCXOpdBLyrHhq");
  252. NSLog(@"FB8wRZxsDd3ciE47");
  253. NSLog(@"o63kx8b9BuAPFwghJYfmelRinVW");
  254. NSLog(@"6GltuL7koW");
  255. NSLog(@"OcmXQDt2WnxETzhJj1yKFe8ofd4");
  256. NSLog(@"krLBEZ3ACiPum7VUhQbNcKM1pHDzoIfdjWTJe");
  257. NSLog(@"dzqthpj8H0x4ETckSPgF59Qe");
  258. NSLog(@"aF1UqATgILQN0lMSbo");
  259. NSLog(@"OhNsYRXkec8dEZBPgrUwu");
  260. NSLog(@"1rB6qAGDc9zCQK5TuS0mejVZdFL2vsxYiog");
  261. NSLog(@"8eMuxHlma59jfGhS0");
  262. NSLog(@"0ym719IvcJWz2VDqAOtQeoURZlLXEMdPukNC");
  263. NSLog(@"29F0PD8yeQCKGTfZpdRSVU4");
  264. NSLog(@"RoQnGdYgE0b9Z5rL6sckUVq71l8aOMASpIDBxwmy");
  265. NSLog(@"8OyYlFxq03BQ");
  266. }
  267. @end