PayAlert.m 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // PayAlert.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/4/30.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "PayAlert.h"
  9. #import "PayAlertCell.h"
  10. static UINib *ViewNib = nil;
  11. @interface PayAlert()<UITableViewDelegate,UITableViewDataSource>
  12. @end
  13. @implementation PayAlert
  14. + (instancetype)share
  15. {
  16. if (ViewNib == nil) {
  17. ViewNib = [UINib nibWithNibName:@"PayAlert" bundle:nil];
  18. }
  19. PayAlert *alert = [[ViewNib instantiateWithOwner:nil options:nil] lastObject];
  20. [alert setTitleColor];
  21. [alert setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  22. alert.bgColor = [UIColor clearColor];
  23. alert.tableView.delegate = alert;
  24. alert.tableView.dataSource = alert;
  25. [alert.disBtn addTarget:alert action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
  26. alert.Constant.constant = 190 + 30 + 70 * 3;
  27. [alert.tableView reloadData];
  28. return alert;
  29. }
  30. - (void)setTitleColor
  31. {
  32. CAGradientLayer *gradientLayer = [CAGradientLayer layer];
  33. gradientLayer.colors = @[(__bridge id)UIColorHex(0x51A2DB).CGColor, (__bridge id)UIColorHex(0x73B9EA).CGColor];
  34. gradientLayer.locations = @[@0.0, @1.0];
  35. gradientLayer.startPoint = CGPointMake(0, 0);
  36. gradientLayer.endPoint = CGPointMake(1.0, 0);
  37. gradientLayer.frame = CGRectMake(0, 0, SCREEN_WIDTH - 32, 40);
  38. [self.titleView.layer addSublayer:gradientLayer];
  39. }
  40. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  41. {
  42. return 3;
  43. }
  44. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  45. {
  46. return [PayAlertCell configCellHeight];
  47. }
  48. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  49. {
  50. PayAlertCell * cell = [PayAlertCell configCell:tableView indexPath:indexPath];
  51. return cell;
  52. }
  53. - (void)show
  54. {
  55. [super show];
  56. }
  57. - (void)dismiss
  58. {
  59. [self dismissWithAnimation:kAlertAnimationBottom];
  60. }
  61. @end