| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- //
- // PaymentAmountVC.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/2/1.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "EarnestAmountVC.h"
- @interface EarnestAmountVC ()
- @end
- @implementation EarnestAmountVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self loadNavStyle];
- [self initUI];
-
- }
- -(void)loadNavStyle
- {
- //右边
- UIButton *btnAdd = [UIButton buttonWithType:UIButtonTypeCustom];
- [btnAdd addTarget:self action:@selector(submitData)
- forControlEvents:UIControlEventTouchUpInside];
- btnAdd.frame = CGRectMake(0, 0,60,14);
- [btnAdd setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- btnAdd.titleLabel.font=[UIFont systemFontOfSize:16];
- [btnAdd setTitle:@"确定" forState:UIControlStateNormal];
-
- UIBarButtonItem *menubtnAdd = [[UIBarButtonItem alloc] initWithCustomView:btnAdd];
- self.navigationItem.title=@"请选择";
- self.navigationItem.rightBarButtonItem = menubtnAdd;
-
-
- //返回
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
- forState:UIControlStateNormal];
- [button addTarget:self action:@selector(goBack)
- forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(0, 0, 15, 18);
-
- UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
- self.navigationItem.leftBarButtonItem = menuButton;
- }
- -(void)submitData{
- [self.view endEditing:YES];
- if([self.paymentDelegate respondsToSelector:@selector(showEarnestInfo:)])
- {
- [self.paymentDelegate showEarnestInfo:_earnestList];
-
- }
- [self.navigationController popViewControllerAnimated:YES];
- }
- -(void)initUI{
- _vTableView = [[UITableView alloc]
- initWithFrame:CGRectMake(0,
- 0,
- self.view.frame.size.width,
- self.view.frame.size.height)];
-
- _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
- _vTableView.backgroundColor = [UIColor whiteColor];
- _vTableView.delegate = self;
- _vTableView.dataSource=self;
- [self.view addSubview:_vTableView];
- if(_earnestList!=nil&&_earnestList.count>0){
- [_vTableView reloadData];
- }
-
- }
- #pragma mark - tableView回调
- /**
- 单元格cell个数
-
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [_earnestList count];
- }
- /**
- <#Description#>
-
- @param tableView <#tableView description#>
- @return <#return value description#>
- */
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- /**
- 高度
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- return 81 ;
-
- }
- /**
- 每个单元格cell
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *cellIdentifier = @"EarnestCell";
- EarnestCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier ];
- cell=[[EarnestCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
- cell.selectionStyle=UITableViewCellSelectionStyleNone;
- cell.cellIndex=indexPath.row;
- cell.delegate=self;
- EarnestModel *earnestModel = [_earnestList objectAtIndex:indexPath.row];
- [cell parseEarnestInfo:earnestModel];
- return cell;
- }
- -(void)updateEarnestInfo:(EarnestCell*)cell{
- NSString *earnestSumValue= cell.txtEarnestSum.text;
- if(earnestSumValue==nil||[earnestSumValue isEqualToString:@""]){
- earnestSumValue=@"0";
- }
- EarnestModel *earnestModel = [_earnestList objectAtIndex:cell.cellIndex];
- earnestModel.earnestSum=earnestSumValue;
- _earnestList[cell.cellIndex]=earnestModel;
- [_vTableView reloadData];
- }
- - (void)goBack
- {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
-
- }
- @end
|