// // PayAlert.m // smartRhino // // Created by niuzhen on 2020/4/30. // Copyright © 2020 tederen. All rights reserved. // #import "PayAlert.h" #import "PayAlertCell.h" static UINib *ViewNib = nil; @interface PayAlert() @end @implementation PayAlert + (instancetype)share { if (ViewNib == nil) { ViewNib = [UINib nibWithNibName:@"PayAlert" bundle:nil]; } PayAlert *alert = [[ViewNib instantiateWithOwner:nil options:nil] lastObject]; [alert setTitleColor]; [alert setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; alert.bgColor = [UIColor clearColor]; alert.tableView.delegate = alert; alert.tableView.dataSource = alert; [alert.disBtn addTarget:alert action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; alert.Constant.constant = 190 + 30 + 70 * 3; [alert.tableView reloadData]; return alert; } - (void)setTitleColor { CAGradientLayer *gradientLayer = [CAGradientLayer layer]; gradientLayer.colors = @[(__bridge id)UIColorHex(0x51A2DB).CGColor, (__bridge id)UIColorHex(0x73B9EA).CGColor]; gradientLayer.locations = @[@0.0, @1.0]; gradientLayer.startPoint = CGPointMake(0, 0); gradientLayer.endPoint = CGPointMake(1.0, 0); gradientLayer.frame = CGRectMake(0, 0, SCREEN_WIDTH - 32, 40); [self.titleView.layer addSublayer:gradientLayer]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 3; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return [PayAlertCell configCellHeight]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { PayAlertCell * cell = [PayAlertCell configCell:tableView indexPath:indexPath]; return cell; } - (void)show { [super show]; } - (void)dismiss { [self dismissWithAnimation:kAlertAnimationBottom]; } @end