PurchaseViewController.m 19 KB
Newer Older
陈俊俊's avatar
陈俊俊 committed
1 2 3 4 5 6 7 8 9
//
//  PurchaseViewController.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/8/23.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "PurchaseViewController.h"
陈俊俊's avatar
陈俊俊 committed
10
#import "NewPurchaseViewController.h"
陈俊俊's avatar
陈俊俊 committed
11 12 13
#import "PurchaseCell.h"
#import "PurchaseBill.h"
#import "PurchaseDetailViewController.h"
陈俊俊's avatar
陈俊俊 committed
14
#import "QueryOrder.h"
n22's avatar
n22 committed
15 16
#import "SortMaskView.h"
#import "PurchaseBoltView.h"
陈俊俊's avatar
陈俊俊 committed
17
#import "MJRefresh.h"
n22's avatar
n22 committed
18

陈俊俊's avatar
陈俊俊 committed
19 20 21 22 23 24 25 26 27 28 29 30
#define TopMargin 44
#define TableHeight 120
#define LeftMargin 20
#define BtnWidth 60
#define BtnHeight 24
#define BtnSize 16

typedef enum : NSUInteger {
    SortTag = 3000,
    BoltTag
    
} BtnTag;
陈俊俊's avatar
陈俊俊 committed
31
@interface PurchaseViewController ()<UITableViewDataSource,UITableViewDelegate,PurchaseViewDelegate,SortMaskViewDelegate,UIGestureRecognizerDelegate>
陈俊俊's avatar
陈俊俊 committed
32 33 34
{
    UIView *_maskView;
    UIButton *currentBtn;
n22's avatar
n22 committed
35 36
    SortMaskView *_sortView;
    PurchaseBoltView *_boltView;
陈俊俊's avatar
陈俊俊 committed
37 38 39
    UIBarButtonItem  *_sureBtn;
    UIButton *_sortBtn;
    UIButton *_boltBtn;
陈俊俊's avatar
陈俊俊 committed
40 41 42
    BOOL _isRefresh;
    BOOL _isLoadMore;
    NSInteger _currentPage;
陈俊俊's avatar
陈俊俊 committed
43 44 45
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
46 47 48
@property (nonatomic,strong)NSString *titleLike;

@property (nonatomic,strong)NSString *vendorLike;
陈俊俊's avatar
陈俊俊 committed
49
@property (nonatomic,strong)NSString *state;
n22's avatar
n22 committed
50
@property (nonatomic,strong)NSString *billLike;
51 52
@property (nonatomic,strong)NSString *productLike;

n22's avatar
n22 committed
53
@property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序)
陈俊俊's avatar
陈俊俊 committed
54 55 56 57 58 59 60 61
@end

@implementation PurchaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor  = XXFBgColor;
    [self initData];
陈俊俊's avatar
陈俊俊 committed
62
    [self createBackBtn];
陈俊俊's avatar
陈俊俊 committed
63
    [self createTableView];
陈俊俊's avatar
陈俊俊 committed
64 65 66
    [self createRefresh];
    [self getData];

陈俊俊's avatar
陈俊俊 committed
67 68 69
}
- (void)initData{
    self.dataArr = [NSMutableArray array];
陈俊俊's avatar
陈俊俊 committed
70 71
    if (self.assessorVendor.length > 0) {
        self.vendorLike = self.assessorVendor;
陈俊俊's avatar
陈俊俊 committed
72
    }
陈俊俊's avatar
陈俊俊 committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
}
- (void)getData{
    [ICRUserUtil sharedInstance].needFresh = NO;
    __weak typeof(self)weakSelf = self;
    void(^succ)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        __strong __typeof(weakSelf)strongSelf = weakSelf;
        [strongSelf fetchtPuchaseList:data];
    };
    void(^fail)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        [IBTLoadingView showTips:data];
    };
    [IBTLoadingView showProgressLabel:@"正在加载..."];
    ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
陈俊俊's avatar
陈俊俊 committed
88
    
陈俊俊's avatar
陈俊俊 committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
    NSMutableArray *orderArr =[NSMutableArray array];
    if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
        QueryOrder *order = [QueryOrder new];
        order.field = @"lastModified";
        order.direction = self.orderDirection;
        [orderArr addObject:[order dictForCommit]];
    }
    id billObject = [NSNull null];
    if (self.billLike.length > 0) {
        billObject = self.billLike;
        if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
            QueryOrder *order = [QueryOrder new];
            order.field = @"billNumber";
            order.direction = self.orderDirection;
            [orderArr addObject:[order dictForCommit]];
        }
    }
    id stateObject = [NSNull null];
    if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
        stateObject = self.state;
        if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
            QueryOrder *order = [QueryOrder new];
            order.field = @"state";
            order.direction = self.orderDirection;
            [orderArr addObject:[order dictForCommit]];
        }
    }
116 117 118 119 120 121 122
    id titleObject = [NSNull null];
    if (self.titleLike.length > 0) {
        titleObject = self.titleLike;
    }
    id vendorObject = [NSNull null];
    if (self.vendorLike.length > 0) {
        vendorObject = self.vendorLike;
陈俊俊's avatar
陈俊俊 committed
123
    }
124 125 126 127
    id productObject = [NSNull null];
    if (self.productLike.length > 0) {
        productObject = self.productLike;
    }
陈俊俊's avatar
陈俊俊 committed
128 129 130 131 132 133 134 135 136
    if (orderArr.count == 0) {
        QueryOrder *order = [QueryOrder new];
        order.field = @"billNumber";
        order.direction = @"desc";
        [orderArr addObject:[order dictForCommit]];
        
    }
    NSDictionary *dict = @{
                           @"billNumberLike":billObject,
137
                           @"productLike":productObject,
陈俊俊's avatar
陈俊俊 committed
138
                           @"state":stateObject,
139 140
                           @"titleLike":titleObject,
                           @"vendorUuid":vendorObject,
陈俊俊's avatar
陈俊俊 committed
141 142 143 144 145 146 147 148 149 150 151 152
                           @"queryOrders":orderArr,
                           @"userUuid":userUtil.userId,
                           @"pageNumber":@(_currentPage),
                           @"pageSize":@(20)};
    [[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail];
}
- (void)fetchtPuchaseList:(id)data{
    if (data) {
        NSInteger success = [data[@"success"] integerValue];
        NSString *message  = data[@"message"] ;
        if (success == 1) {
            if (_currentPage == 0) {
陈俊俊's avatar
陈俊俊 committed
153 154 155
                if (self.dataArr.count > 0) {
                    [self.dataArr removeAllObjects];
                }
陈俊俊's avatar
陈俊俊 committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
            }
            NSArray *recodesArr = data[ @"data" ][ @"records" ];
            for (NSDictionary *purchaseBillDict in recodesArr) {
                PurchaseBill *purchaseBill = [[PurchaseBill alloc]init];
                [purchaseBill setValuesForKeysWithDictionary:purchaseBillDict];
                [self.dataArr addObject:purchaseBill];
            }
            NSDictionary *pageDict = data[ @"data" ][ @"paging" ];
            NSInteger pageCount = [pageDict[@"pageCount"] integerValue];
            [self.tableView reloadData];
            [self endRefreshing];
            if (pageCount <= _currentPage) {
                [self.tableView.footer noticeNoMoreData];
            }
            if (_currentPage == 0 && self.dataArr.count > 0) {
                [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
            }
        }else{
            [IBTLoadingView showTips:message];
        }
    }else{
        [IBTLoadingView showTips:@"      无记录      "];
    }


}
- (void)createRefresh{
    self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        if (_isRefresh) {
            return ;
        }
        _isRefresh = YES;
        _currentPage = 0;
        [self getData];
    }];
    self.tableView.header.lastUpdatedTimeKey = PurchaseUpdateDate;
    
    self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        if (_isLoadMore) {
            return ;
        }
        _isLoadMore = YES;
        _currentPage ++;
        [self getData];
    } ];
}
#pragma mark - 结束刷新
- (void)endRefreshing{
    _isLoadMore = NO;
    _isRefresh = NO;
    [self.tableView.header endRefreshing];
    [self.tableView.footer endRefreshing];
陈俊俊's avatar
陈俊俊 committed
208 209 210 211
}
- (void)createTableView
{
    _sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
陈俊俊's avatar
陈俊俊 committed
212 213
    self.navigationItem.rightBarButtonItem = _sureBtn;

陈俊俊's avatar
陈俊俊 committed
214
    _sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil];
陈俊俊's avatar
陈俊俊 committed
215 216 217
    _sortBtn.titleLabel.font = FontSize(BtnSize);
    [self.view addSubview:_sortBtn];
    
陈俊俊's avatar
陈俊俊 committed
218
    _boltBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(ScreenSize.width-BtnWidth - LeftMargin,10,BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:BoltTag image:@"black_filter_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil];
陈俊俊's avatar
陈俊俊 committed
219 220 221 222 223 224 225 226 227 228 229
    _boltBtn.titleLabel.font = FontSize(BtnSize);
    [self.view addSubview:_boltBtn];
    
    
    self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
    _maskView = [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, ScreenSize.height - 64- TopMargin)];
    _maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
陈俊俊's avatar
陈俊俊 committed
230 231 232
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hiddenMaskView)];
    [_maskView addGestureRecognizer:tap];
    tap.delegate = self;
陈俊俊's avatar
陈俊俊 committed
233 234 235
    _maskView.hidden = YES;
    [self.view addSubview:_maskView];
}
陈俊俊's avatar
陈俊俊 committed
236 237 238 239 240 241 242 243 244 245 246 247
#pragma mark - 手势代理方法
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
    // 输出点击的view的类名
    NSLog(@"%@", NSStringFromClass([touch.view class]));
    
    // 若为UITableViewCellContentView(即点击了tableViewCell),则不截获Touch事件
    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
        return NO;
    }
    return  YES;
}
陈俊俊's avatar
陈俊俊 committed
248 249
#pragma mark -按钮事件
- (void)sortClick:(UIButton *)btn{
n22's avatar
n22 committed
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
    _maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
    _maskView.hidden = NO;
    if (btn.tag == SortTag) {
        if(_boltView){
            [self hiddenBoltMaskView:NO];
        }
        if (currentBtn == btn) {
            [btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
            [self hiddenSortMaskView:YES];
            currentBtn = nil;
        }else{
            [btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
            if (_sortView == nil) {
                _sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 150) withOrderDirection:self.orderDirection];
                _sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"按时间顺序",@"按时间逆序",@"默认排序",nil];
                _sortView.delegate = self;
                [_maskView addSubview:_sortView];
                [UIView animateWithDuration:0.25 animations:^{
                    CGRect sortFrame = _sortView.frame;
                    sortFrame.origin.y = 0;
                    _sortView.frame = sortFrame;
                }];
            }
            currentBtn = btn;
        }
    }else if(btn.tag == BoltTag){
        if (_sortView) {
            [self hiddenSortMaskView:NO];
        }
        if (currentBtn == btn) {
            [btn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
            [self hiddenBoltMaskView:YES];
            currentBtn = nil;
            
        }else{
            [btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
            if (_boltView == nil) {
287
                _boltView = [[PurchaseBoltView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 274) state:self.state billNumber:self.billLike titleStr:self.titleLike vendorNumber:self.vendorLike productNumber:self.productLike];
n22's avatar
n22 committed
288
                
陈俊俊's avatar
陈俊俊 committed
289
                _boltView.backgroundColor = XXFBgColor;
n22's avatar
n22 committed
290 291
                _boltView.delegate = self;
                //initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
292
                _boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"未提交",@"未审批",@"已拒绝" ,@"发运中",@"已作废",@"已完成",@"提交系统处理",@"系统处理失败",nil];
n22's avatar
n22 committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
                [_maskView addSubview:_boltView];
                [UIView animateWithDuration:0.25 animations:^{
                    CGRect sortFrame = _boltView.frame;
                    sortFrame.origin.y = 0;
                    _boltView.frame = sortFrame;
                }];
                currentBtn = btn;
            }
        }
    }
}

- (void)hiddenSortMaskView:(BOOL)isHide{
    currentBtn = nil;
    [self checkSortBtnColor];
    if (isHide == NO) {
        [_sortView removeFromSuperview];
        _sortView = nil;
    }else{
        [UIView animateWithDuration:0.25 animations:^{
            CGRect sortFrame = _sortView.frame;
            sortFrame.origin.y = -105;
            _sortView.frame = sortFrame;
            _maskView.backgroundColor = RGBA(0, 0, 0, 0);
        }completion:^(BOOL finished) {
            [_sortView removeFromSuperview];
            _sortView = nil;
            _maskView.hidden = YES;
        }];
    }
}
- (void)hiddenBoltMaskView:(BOOL)isHide{
    currentBtn = nil;
    [self checkBoltBtnColor];
    if (isHide == NO) {
        [_boltView removeFromSuperview];
        _boltView = nil;
    }else{
        [UIView animateWithDuration:0.25 animations:^{
            CGRect sortFrame = _boltView.frame;
            sortFrame.origin.y = -105;
            _boltView.frame = sortFrame;
            _maskView.backgroundColor = RGBA(0, 0, 0, 0);
        }completion:^(BOOL finished) {
            [_boltView removeFromSuperview];
            _boltView = nil;
            _maskView.hidden = YES;
        }];
    }
}

//检测排序的颜色
- (void)checkSortBtnColor{
    if (self.orderDirection.length > 0) {
        [_sortBtn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
    }else{
        [_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
        
    }
}
- (void)checkBoltBtnColor{
354
    if (self.state.length > 0 || self.titleLike.length > 0 || self.billLike.length > 0 || self.vendorLike.length > 0 || self.productLike.length > 0) {
n22's avatar
n22 committed
355 356 357 358 359
        [_boltBtn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
    }else{
        [_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
        
    }
陈俊俊's avatar
陈俊俊 committed
360 361 362
}
#pragma mark - 确定
- (void)sureClick{
陈俊俊's avatar
陈俊俊 committed
363
    
364 365 366
    [_boltView.titleFiled resignFirstResponder];
    [_boltView.billFiled resignFirstResponder];
    [_boltView.vendorFiled resignFirstResponder];
367
    [_boltView.productFiled resignFirstResponder];
368 369 370 371 372 373 374 375 376 377 378
    _currentPage = 0;
    
    //请求
    [self getData];
    
    //还原数据
    if (_sortView) {
        [self hiddenSortMaskView:YES];
    }
    if (_boltView) {
        [self hiddenBoltMaskView:YES];
陈俊俊's avatar
陈俊俊 committed
379
    }
陈俊俊's avatar
陈俊俊 committed
380
}
n22's avatar
n22 committed
381 382 383 384 385

#pragma mark - sortDelegate
- (void)getSortValueSelectRow:(NSString *)state{
    if (state.length > 0) {
        self.orderDirection = state;
n22's avatar
n22 committed
386
        CLog(@"%@",state);
n22's avatar
n22 committed
387 388 389 390 391
    }
}
#pragma mark - boltDelegate
- (void)getBoltValueSelectRow:(NSString *)state{
    self.state = state;
n22's avatar
n22 committed
392
    CLog(@"%@",state);
n22's avatar
n22 committed
393 394 395
}
- (void)getbillLike:(NSString *)billLike{
    self.billLike = billLike;
n22's avatar
n22 committed
396
    CLog(@"%@",billLike);
n22's avatar
n22 committed
397
}
398 399 400 401 402 403 404
- (void)gettitleLike:(NSString *)titleLike{
    self.titleLike = titleLike;
    CLog(@"%@",titleLike);
}
- (void)getvendorLike:(NSString *)vendorLike{
    self.vendorLike = vendorLike;
    CLog(@"%@",vendorLike);
n22's avatar
n22 committed
405
}
406 407 408 409
- (void)getproductLike:(NSString *)productLike{
    self.productLike = productLike;
    CLog(@"%@",productLike);
}
n22's avatar
n22 committed
410 411 412 413 414
- (void)clearBoltInformation{
    //清空所有条件
    if (self.billLike.length > 0) {
        self.billLike = @"";
    }
415 416
    if (self.titleLike.length > 0) {
        self.titleLike = @"";
n22's avatar
n22 committed
417 418 419 420
    }
    if (self.state.length > 0) {
        self.state = @"";
    }
421 422 423
    if (self.vendorLike.length > 0) {
        self.vendorLike = @"";
    }
424 425 426
    if (self.productLike.length > 0) {
        self.productLike = @"";
    }
n22's avatar
n22 committed
427
}
428 429 430 431 432 433 434 435 436
#pragma mark - 隐藏maskView
- (void)hiddenMaskView{
    if (_sortView) {
        [self hiddenSortMaskView:YES];
    }
    if (_boltView) {
        [self hiddenBoltMaskView:YES];
    }
}
陈俊俊's avatar
陈俊俊 committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellID = @"SurveyID";
    PurchaseCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[PurchaseCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    if (self.dataArr.count > 0) {
        PurchaseBill *bill = self.dataArr[indexPath.row];
        [cell setPurchaseBill:bill];
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
陈俊俊's avatar
陈俊俊 committed
460 461 462 463 464 465
    
    if (_dataArr.count > 0) {
        PurchaseBill *bill = _dataArr[indexPath.row];
        if ([bill.state isEqualToString:PURCHASE_STATE_INITIAL] || [bill.state isEqualToString:PURCHASE_STATE_REJECTED]) {
            NewPurchaseViewController *nvc = [NewPurchaseViewController new];
            nvc.purchaseBill = bill;
陈俊俊's avatar
陈俊俊 committed
466
            nvc.title = @"修改采购单";
陈俊俊's avatar
陈俊俊 committed
467 468
            [self PushViewController:nvc animated:YES];
        }else{
Sandy's avatar
Sandy committed
469 470
            
            
陈俊俊's avatar
陈俊俊 committed
471 472 473
            PurchaseDetailViewController *pvc = [PurchaseDetailViewController new];
            pvc.title = @"查看采购单";
            pvc.bill = bill;
Sandy's avatar
Sandy committed
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
            
            void(^fail)(id) = ^(id data) {
                [IBTLoadingView hideHUDWithText:nil];
                [IBTLoadingView showTips:data];
            };
            
            __weak UIViewController *weakSelf = self;
            //先判断是否wms或中心仓
            [IBTLoadingView showProgressLabel:@"正在加载..."];
            [HTTP isWmsWarehouse:bill.receiveWrh_uuid success:^(id succ) {
                pvc.isWms = [succ[@"data"] boolValue];
                [HTTP isCenterWarehouse:bill.receiveWrh_uuid success:^(id succ) {
                    [IBTLoadingView hideHUDWithText:nil];
                    pvc.isCenter = [succ[@"data"] boolValue];
                    [weakSelf PushViewController:pvc animated:YES];
                } failure:fail];
            } failure:fail];
            
            
陈俊俊's avatar
陈俊俊 committed
493
        }
n22's avatar
n22 committed
494
    }
陈俊俊's avatar
陈俊俊 committed
495 496 497 498 499 500
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return TableHeight;
}

陈俊俊's avatar
陈俊俊 committed
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
- (void)createBackBtn{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    btn.frame  = CGRectMake(0, 0, 12, 20);
    [btn addTarget:self action:@selector(backRV) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithCustomView:btn];
    self.navigationItem.leftBarButtonItem = back;
}
- (void)backRV{
    [self PopToRootViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    if ([ICRUserUtil sharedInstance].needFresh && self.tableView != nil) {
        [self.tableView.header beginRefreshing];
    }
}
陈俊俊's avatar
陈俊俊 committed
518 519 520 521 522 523 524 525 526 527 528 529 530 531
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end