| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- //
- // StatusInfoTextVC.m
- // IBOSS
- //
- // Created by apple on 16/1/6.
- // Copyright © 2016年 elongtian. All rights reserved.
- //
- #import "StatusInfoTextVC.h"
- #import "StatusInfo.h"
- #import "CustomerReportTextTableViewCell.h"
- @interface StatusInfoTextVC ()<UITableViewDataSource,UITableViewDelegate>
- @property(nonatomic,strong) UITableView *tableView;
- @property(nonatomic,strong) UIBarButtonItem *menuButtonOk;
- @property(nonatomic,strong) UIButton *btnOk;
- @end
- @implementation StatusInfoTextVC
- #pragma mark - 公共函数
- /**
- 初始化
-
- @return <#return value description#>
- */
- -(instancetype)init{
- self=[super init];
- if(self){
- self.filterArr=[NSMutableArray new];
- }
-
- return self;
- }
- /**
- viewDidLoad
- */
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.navigationItem.title=@"请选择";
-
- if (_isPresentViewFlag) {
- UIView *vTitle = [[UIView alloc]init];
- vTitle.frame = CGRectMake(0, 0, Screen_Width, 44 + rectStatusHeight);
- vTitle.backgroundColor = NavigationBarTintColor;
- [self.view addSubview:vTitle];
-
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setImage:[UIImage imageNamed:@"icon_back"]
- forState:UIControlStateNormal];
- [button addTarget:self action:@selector(GotoBack)
- forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(20, rectStatusHeight + 13, 9, 15);
- [vTitle addSubview:button];
- UILabel *lblTitle = [[UILabel alloc]init];
- lblTitle.frame = CGRectMake(9, rectStatusHeight + 13, Screen_Width-2*9 - 20, 15);
- lblTitle.textColor = [UIColor whiteColor];
- lblTitle.text = @"请选择";
- lblTitle.textAlignment = NSTextAlignmentCenter;
- [vTitle addSubview:lblTitle];
-
-
- }else{
- self.navigationItem.title=@"请选择";
- self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor],NSFontAttributeName : [UIFont boldSystemFontOfSize:16]};
- self.navigationController.navigationBar.barTintColor = NavigationBarTintColor;
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setImage:[UIImage imageNamed:@"icon_back"]
- forState:UIControlStateNormal];
- [button addTarget:self action:@selector(GotoBack)
- forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(0, 0, 15, 18);
-
- UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
- self.navigationItem.leftBarButtonItem = menuButton;
- [self.navigationController setNavigationBarHidden:NO];
-
- }
-
- _tableView=[UITableView new];
- _tableView.delegate=self;
- _tableView.dataSource=self;
-
- //是否是dismissViewController
- if (_isPresentViewFlag) {
- self.tableView.frame = CGRectMake(0, 44 + rectStatusHeight, self.view.bounds.size.width, self.view.bounds.size.height - 44 - rectStatusHeight - 1) ;
- }
- else{
- self.tableView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height-rectNavHeight - rectStatusHeight - 1) ;
- }
-
- [self.view addSubview:self.tableView];
- }
- /**
- viewWillAppear
-
- @param animated <#animated description#>
- */
- -(void)viewWillAppear:(BOOL)animated{
-
- if(!_filterArr){
- _filterArr=[NSMutableArray new];
- //_searchArr=[NSMutableArray new];
- }
-
- [self.tableView reloadData];
-
- }
- #pragma mark - Table view data source cell
- /**
- 单元格cell
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- static NSString *CellIdentifier = @"CustomerReportTextTableViewCell";
-
- CustomerReportTextTableViewCell *cell =(CustomerReportTextTableViewCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- // if (cell == nil) {
- // cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
- // }
-
- if(cell==nil){
- NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomerReportTextTableViewCell" owner:self options:nil];
- cell=[nib objectAtIndex:0];
- }
- cell.frame=CGRectMake(cell.frame.origin.x, cell.frame.origin.y,self.view.bounds.size.width , cell.frame.size.height);
- cell.name.frame=CGRectMake(cell.name.frame.origin.x, cell.name.frame.origin.y,cell.frame.size.width , cell.name.frame.size.height);
-
- StatusInfo* s=(StatusInfo*)self.filterArr[indexPath.row];
-
- cell.idCode.hidden=YES;
-
- cell.idCode.text=s.statusId;
-
- cell.name.text=s.name;
-
- return cell;
- }
- #pragma mark -Table view data source number
- /**
- 行数
-
- @param tableView <#tableView description#>
- @param section <#section description#>
- @return <#return value description#>
- */
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return _filterArr.count;
- }
- /**
- 高度
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 40.0f;
- }
- /**
- 单元格点击事件
-
- @param tableView <#tableView description#>
- @param indexPath <#indexPath description#>
- */
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- if ([self.sdelegate respondsToSelector:@selector(showStatusValue:)]) {
- [self.sdelegate showStatusValue:self.filterArr[indexPath.row]];
- }
-
- //是否是dismissViewController
- if (_isPresentViewFlag) {
- [self dismissViewControllerAnimated:YES completion:nil];
- }else{
- [self.navigationController popViewControllerAnimated:YES];
- }
- }
- /**
- didReceiveMemoryWarning
- */
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
-
- }
- /**
- dealloc
- */
- -(void)dealloc{
-
- }
- #pragma mark 返回
- -(void)GotoBack
- {
- //是否是dismissViewController
- if (_isPresentViewFlag) {
- [self dismissViewControllerAnimated:YES completion:nil];
- }else{
- [self.navigationController popViewControllerAnimated:YES];
- }
- }
- @end
|