NewSurveyViewController.m 17.4 KB
Newer Older
陈俊俊's avatar
陈俊俊 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//
//  NewSurveyViewController.m
//  XFFurit
//
//  Created by 陈俊俊 on 15/8/1.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//  新建行情调研



#import "NewSurveyViewController.h"
#import "SurveyCell.h"
#import "HPGrowingTextView.h"
#import "StartTimeView.h"
n22's avatar
n22 committed
15
#import "ChosePersonViewController.h"
n22's avatar
n22 committed
16
#import "ChooseProductViewController.h"
陈俊俊's avatar
陈俊俊 committed
17
#import "SurveyUser.h"
18
#import "Survey.h"
n22's avatar
n22 committed
19
#import "Product.h"
陈俊俊's avatar
陈俊俊 committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#define LeftMargin 15
#define BtnHeight 44
#define TableHeight 46
#define CornerRadius 5
#define TitleSize 15
#define BtnSize 19
#define TotalHeight 432
#define KeyboardHeight 258
#define DateViewHeight 300
typedef enum : NSUInteger {
    SaveTag = 2000,
    CommitTag,
} BtnTag;

@interface NewSurveyViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate,StartTimeViewDelegate>
{
    UITableView *_tableView;
    NSMutableArray *_dataArr;
    UITextField *_titleField;
    UILabel *_productLabel;
    UILabel *_startDateLabel;
    UILabel *_endDateLabel;
    UILabel *_personLabel;
    HPGrowingTextView *_noteTextView;
    UIDatePicker *_timePicker;
    BOOL _isClickStart;
    StartTimeView *_startTimeView;
}
陈俊俊's avatar
陈俊俊 committed
48 49 50 51 52 53 54
@property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productNameStr;
@property (nonatomic,strong)NSString *productUuidStr;
@property (nonatomic,strong)NSString *beginDateStr;
@property (nonatomic,strong)NSString *endDateStr;
@property (nonatomic,strong)NSString *remarkStr;
陈俊俊's avatar
陈俊俊 committed
55 56
@property (nonatomic,strong)NSMutableArray *users;

陈俊俊's avatar
陈俊俊 committed
57 58 59 60 61 62
@end

@implementation NewSurveyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
陈俊俊's avatar
陈俊俊 committed
63
    self.title = self.navTitle;
陈俊俊's avatar
陈俊俊 committed
64
    [self initData];
陈俊俊's avatar
陈俊俊 committed
65
    [self createTableView];    
陈俊俊's avatar
陈俊俊 committed
66 67 68
}
- (void)initData{
    _dataArr = [NSMutableArray array];
陈俊俊's avatar
陈俊俊 committed
69
    self.users = [NSMutableArray array];
陈俊俊's avatar
陈俊俊 committed
70 71 72 73 74 75 76 77 78 79
    [_dataArr addObject:@"标题"];
    [_dataArr addObject:@"商品"];
    [_dataArr addObject:@"开始日期"];
    [_dataArr addObject:@"结束日期"];
    [_dataArr addObject:@"调研人员"];
    [_dataArr addObject:@"备注"];
}

- (void)createTableView
{
陈俊俊's avatar
陈俊俊 committed
80 81
    self.view.backgroundColor  = XXFBgColor;

陈俊俊's avatar
陈俊俊 committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
    _tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, LeftMargin,ScreenSize.width, ScreenSize.height - 64 - LeftMargin)) style:(UITableViewStylePlain)];
    _tableView.backgroundColor = [UIColor whiteColor];
    _tableView.bounces = NO;
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
    
    UIButton *saveBtn =  [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:HexColor(@"50bd62")];
    [footView addSubview:saveBtn];
    
    UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(saveBtn.frame.origin.x + saveBtn.frame.size.width + LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:HexColor(@"f69100")];
    [footView addSubview:commitBtn];
    
    [self.view addSubview:footView];
    _tableView.tableFooterView = footView;
    [self.view addSubview:_tableView];
}

#pragma mark - 按钮点击事件
- (void)btnClick:(UIButton *)btn{
    switch (btn.tag) {
        case SaveTag:
        {
陈俊俊's avatar
陈俊俊 committed
106
            if ([self checkSurvey]) {
n22's avatar
n22 committed
107
                [self saveSurvey:@"initial" message:@"正在保存..."];
陈俊俊's avatar
陈俊俊 committed
108
            }
陈俊俊's avatar
陈俊俊 committed
109 110 111 112
        }
            break;
        case CommitTag:
        {
n22's avatar
n22 committed
113 114 115
            if ([self checkSurvey]) {
                [self saveSurvey:@"submitted" message:@"正在提交..."];
            }
陈俊俊's avatar
陈俊俊 committed
116 117 118 119 120 121
        }
            break;
        default:
            break;
    }
}
陈俊俊's avatar
陈俊俊 committed
122
- (BOOL)checkSurvey{
陈俊俊's avatar
陈俊俊 committed
123 124 125
    self.titleStr = _titleField.text;
    self.remarkStr = _noteTextView.text;
    if (self.titleStr.length == 0 || self.productUuidStr.length == 0 || self.productNameStr.length == 0|| self.productCodeStr.length == 0 || self.users.count <=0 || self.beginDateStr.length == 0 || self.endDateStr.length == 0) {
陈俊俊's avatar
陈俊俊 committed
126 127 128 129 130 131
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示信息" message:@"信息不完整" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [alert show];
        return NO;
    }
    return YES;
}
陈俊俊's avatar
陈俊俊 committed
132 133


陈俊俊's avatar
陈俊俊 committed
134
#pragma mark - 保存
n22's avatar
n22 committed
135
- (void)saveSurvey:(NSString *)state message:(NSString *)msg
陈俊俊's avatar
陈俊俊 committed
136 137 138 139
{
    //保存
    void(^succ)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
n22's avatar
n22 committed
140 141 142 143 144
        if (data) {
            NSInteger success = [data[@"success"] integerValue];
            NSString *message = data[@"message"];
            if (success == 1) {
                //成功
陈俊俊's avatar
陈俊俊 committed
145
                [IBTLoadingView showTips:@"操作成功"];
陈俊俊's avatar
陈俊俊 committed
146
                [self clearAllInformation];
陈俊俊's avatar
陈俊俊 committed
147 148 149 150
                if (self.survey) {
                    [ICRUserUtil sharedInstance].needFresh = YES;
                    [self.navigationController popViewControllerAnimated:YES];
                }
n22's avatar
n22 committed
151 152 153 154
            }else{
                [IBTLoadingView showTips:message];
            }
        }
陈俊俊's avatar
陈俊俊 committed
155 156 157 158 159
    };
    void(^fail)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        [IBTLoadingView showTips:data];
    };
陈俊俊's avatar
陈俊俊 committed
160 161 162 163 164 165 166 167
    id uuidObject = [NSNull null];
    if(self.survey.uuid.length > 0){
        uuidObject = self.survey.uuid;
    }
    id billNumberObject = [NSNull null];
    if (self.survey.billNumber > 0) {
        billNumberObject = self.survey.billNumber;
    }
n22's avatar
n22 committed
168 169 170 171
    NSNumber *version = [NSNumber numberWithLong:0];
    if (self.survey) {
        version = self.survey.version;
    }
陈俊俊's avatar
陈俊俊 committed
172
    NSDictionary *dict = @{@"uuid":uuidObject,
n22's avatar
n22 committed
173
                           @"version":version,
陈俊俊's avatar
陈俊俊 committed
174 175
                           @"billnumber":billNumberObject,
                           @"title":[IBTCommon checkString:self.titleStr],
n22's avatar
n22 committed
176
                           @"state":state,
陈俊俊's avatar
陈俊俊 committed
177 178 179 180 181 182
                           @"productUuid":[IBTCommon checkString:self.productUuidStr],
                           @"productCode":[IBTCommon checkString:self.productCodeStr],
                           @"productName":[IBTCommon checkString:self.productNameStr],
                           @"beginDate":[IBTCommon checkString:self.beginDateStr],
                           @"endDate":[IBTCommon checkString:self.endDateStr],
                           @"remark":[IBTCommon checkString:self.remarkStr],
n22's avatar
n22 committed
183
                           @"users":self.users};
184
    [IBTLoadingView showProgressLabel:msg];    
陈俊俊's avatar
陈俊俊 committed
185 186 187
    [[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail];
}

陈俊俊's avatar
陈俊俊 committed
188 189 190 191 192 193 194 195 196 197
- (void)clearAllInformation{
    _titleField.text = @"";
    _productLabel.text = @"请输入商品";
    _productLabel.textColor = HexColor(@"bbbbbb");
    _startDateLabel.text = @"选择日期";
    _startDateLabel.textColor = HexColor(@"bbbbbb");
    _endDateLabel.text = @"选择日期";
    _endDateLabel.textColor = HexColor(@"bbbbbb");
    _personLabel.text = @"选择调研人员";
    _personLabel.textColor = HexColor(@"bbbbbb");
n22's avatar
n22 committed
198
    _noteTextView.text =  @"";
陈俊俊's avatar
陈俊俊 committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212
    //清空数据
    self.titleStr = @"";
    self.productCodeStr = @"";
    self.productNameStr = @"";
    self.productUuidStr = @"";
    self.beginDateStr = @"";
    self.endDateStr = @"";
    [self.users removeAllObjects];
    self.remarkStr = @"";
}




陈俊俊's avatar
陈俊俊 committed
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243

#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellID = @"cellID";
    SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        if (indexPath.row >0 && indexPath.row < _dataArr.count - 1) {
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        }
        [self createViewInCell:cell indexPath:indexPath];
    }
    [cell setTitleStr:_dataArr[indexPath.row]];
    return cell;
}

-  (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        _titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
        _titleField.textAlignment = NSTextAlignmentRight;
        _titleField.textColor = HexColor(@"444444");
        _titleField.placeholder = @"输入调研标题";
        _titleField.font = FontSize(15);
陈俊俊's avatar
陈俊俊 committed
244
        _titleField.returnKeyType = UIReturnKeyDone;
陈俊俊's avatar
陈俊俊 committed
245 246
        _titleField.delegate = self;
        [cell.contentView addSubview:_titleField];
陈俊俊's avatar
陈俊俊 committed
247 248 249 250
        if (self.survey) {
            _titleField.text = [IBTCommon checkString:self.survey.title];
            self.titleStr = [IBTCommon checkString:self.survey.title];
        }
陈俊俊's avatar
陈俊俊 committed
251 252 253 254 255 256 257 258
    }else if (indexPath.row == _dataArr.count -1){
        _noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
        _noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
        _noteTextView.minNumberOfLines = 1;
        _noteTextView.maxNumberOfLines = 4;
        _noteTextView.font = FontSize(15);
        _noteTextView.textAlignment = NSTextAlignmentRight;
        _noteTextView.delegate = self;
陈俊俊's avatar
陈俊俊 committed
259
        _noteTextView.returnKeyType = UIReturnKeyDone;
陈俊俊's avatar
陈俊俊 committed
260 261
        _noteTextView.placeholder = @"输入备注内容";
        [cell.contentView addSubview:_noteTextView];
陈俊俊's avatar
陈俊俊 committed
262 263 264 265
        if (self.survey) {
            _noteTextView.text =  [IBTCommon checkString:self.survey.remark];
            self.remarkStr = [IBTCommon checkString:self.survey.remark];
        }
陈俊俊's avatar
陈俊俊 committed
266 267 268 269 270 271 272 273 274 275 276 277
        CGRect lineFrame =  cell.lineLabel.frame;
        lineFrame.origin.y = TableHeight*2-1;
        cell.lineLabel.frame = lineFrame;
    }else{
        UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
        contentLabel.textAlignment= NSTextAlignmentRight;
        contentLabel.textColor = HexColor(@"bbbbbb");
        contentLabel.font = FontSize(TitleSize);
        [cell.contentView addSubview:contentLabel];
        if (indexPath.row == 1) {
            contentLabel.text = @"选择商品";
            _productLabel = contentLabel;
陈俊俊's avatar
陈俊俊 committed
278
            [self preferDataInProductLabel];
陈俊俊's avatar
陈俊俊 committed
279 280 281
        }else if(indexPath.row == 2){
            contentLabel.text = @"选择日期";
            _startDateLabel = contentLabel;
陈俊俊's avatar
陈俊俊 committed
282 283 284 285 286 287 288 289
            if (self.survey) {
                if (self.survey.beginDate.length > 9) {
                    _startDateLabel.text = [[IBTCommon checkString:self.survey.beginDate]substringToIndex:10];
                }
                _startDateLabel.textColor = HexColor(@"444444");
                self.beginDateStr =[IBTCommon checkString:self.survey.beginDate];
                
            }
陈俊俊's avatar
陈俊俊 committed
290 291 292
        }else if(indexPath.row == 3){
            contentLabel.text = @"选择日期";
            _endDateLabel = contentLabel;
陈俊俊's avatar
陈俊俊 committed
293 294 295 296 297 298 299
            if (self.survey) {
                if (self.survey.endDate.length > 9) {
                    _endDateLabel.text = [[IBTCommon checkString:self.survey.endDate]substringToIndex:10];
                }
                _endDateLabel.textColor = HexColor(@"444444");
                self.endDateStr = [IBTCommon checkString:self.survey.endDate];
            }
陈俊俊's avatar
陈俊俊 committed
300 301 302
        }else if(indexPath.row == 4){
            contentLabel.text = @"选择调研人员";
            _personLabel = contentLabel;
陈俊俊's avatar
陈俊俊 committed
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
            [self preferDataInPersonLabel];
        }
    }
}
- (void)preferDataInPersonLabel{
    if (self.survey) {
        if (self.survey.users.count > 0) {
            NSString *personStr = @"";
            for (SurveyUser * surveyUser in self.survey.users) {
                if (personStr.length == 0) {
                    personStr = [personStr stringByAppendingFormat:@"%@",surveyUser.userName];
                }else {
                    personStr = [personStr stringByAppendingFormat:@"、%@",surveyUser.userName];
                }
            }
            _personLabel.text = personStr;
            _personLabel.textColor = HexColor(@"444444");
            
        }
        if (self.users > 0) {
            [self.users addObjectsFromArray:self.survey.users];
陈俊俊's avatar
陈俊俊 committed
324 325 326
        }
    }
}
陈俊俊's avatar
陈俊俊 committed
327 328 329 330 331 332 333 334 335 336
- (void)preferDataInProductLabel{
    if (self.survey) {
        _productLabel.text = [IBTCommon checkString:self.survey.productName];
        _productLabel.textColor = HexColor(@"444444");
        self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
        self.productNameStr = [IBTCommon checkString:self.survey.productName];
        self.productUuidStr = [IBTCommon checkString:self.survey.productUuid];
    }
}

陈俊俊's avatar
陈俊俊 committed
337 338 339 340 341 342 343 344 345
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 5){
        return TableHeight*2;
    }else{
        return TableHeight;
    }
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 2 || indexPath.row == 3) {
陈俊俊's avatar
陈俊俊 committed
346
        [self keyboardHidden];
陈俊俊's avatar
陈俊俊 committed
347 348 349 350 351 352
        if (indexPath.row == 2) {
            _isClickStart = YES;
        }else{
            _isClickStart = NO;
        }
        [self startDatePickView];
n22's avatar
n22 committed
353 354
    }else if(indexPath.row == 4){
        ChosePersonViewController *cvc = [ChosePersonViewController new];
陈俊俊's avatar
陈俊俊 committed
355 356
        cvc.chosePerson = ^(NSArray *users){
            NSString *textStr = @"";
陈俊俊's avatar
陈俊俊 committed
357
            if (self.users.count > 0) {
陈俊俊's avatar
陈俊俊 committed
358 359
                [self.users removeAllObjects];
            }
陈俊俊's avatar
陈俊俊 committed
360
            for (SurveyUser *user in users) {
陈俊俊's avatar
陈俊俊 committed
361 362 363 364 365
                if (textStr.length == 0) {
                    textStr = [textStr stringByAppendingFormat:@"%@",user.userName];
                }else {
                    textStr = [textStr stringByAppendingFormat:@"、%@",user.userName];
                }
陈俊俊's avatar
陈俊俊 committed
366 367 368
                [self.users addObject:[user dictForCommit]];
            }
            _personLabel.text = textStr;
n22's avatar
n22 committed
369 370 371 372
            _personLabel.textColor = HexColor(@"444444");
        };
        cvc.isMoreChose = YES;
        [self PushViewController:cvc animated:YES];
n22's avatar
n22 committed
373 374
    }else  if(indexPath.row == 1){
        ChooseProductViewController *cvc = [ChooseProductViewController new];
n22's avatar
n22 committed
375 376
        cvc.choseProduct = ^(Product *product){
            _productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
n22's avatar
n22 committed
377
            _productLabel.textColor = HexColor(@"444444");
陈俊俊's avatar
陈俊俊 committed
378 379 380
            self.productNameStr = product.name;
            self.productUuidStr = product.uuid;
            self.productCodeStr = product.code;
n22's avatar
n22 committed
381 382 383
        };
        cvc.isMoreChose = NO;
        [self PushViewController:cvc animated:YES];
陈俊俊's avatar
陈俊俊 committed
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
    }
}

- (void)startDatePickView{
    if (!_startTimeView) {
        _startTimeView = [[StartTimeView alloc] initWithFrame:CGRectMake(0, ScreenSize.height, ScreenSize.width, ScreenSize.height - 64)];
        _startTimeView.delegate = self;
        _startTimeView.backgroundColor        = RGBA(0, 0, 0 ,0.5);
        [self.view addSubview:_startTimeView];
        
        [UIView animateWithDuration:0.15 animations:^{
            CGRect startFrame =  _startTimeView.frame;
            startFrame.origin.y =  0;
            _startTimeView.frame = startFrame;
        } completion:^(BOOL finished) {
            
        }];
    }
}

- (void)cancelTimeView{
    [self clearDatePickView];
}
- (void)okTimeView:(NSDate *)time{
    if (_isClickStart) {
        _startDateLabel.textColor = HexColor(@"444444");
陈俊俊's avatar
陈俊俊 committed
410 411
        _startDateLabel.text = [IBTCommon stringFromDate:time];
        self.beginDateStr = [time httpParameterString];
陈俊俊's avatar
陈俊俊 committed
412 413
    }else{
        _endDateLabel.textColor = HexColor(@"444444");
陈俊俊's avatar
陈俊俊 committed
414 415
        _endDateLabel.text = [IBTCommon stringFromDate:time];
        self.endDateStr = [time httpParameterString];
陈俊俊's avatar
陈俊俊 committed
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
    }
    // 关闭选择器
    [self clearDatePickView];
}
#pragma mark - 取消
- (void)clearDatePickView{
    [UIView animateWithDuration:0.15 animations:^{
        CGRect startFrame =  _startTimeView.frame;
        startFrame.origin.y = ScreenSize.height;
        _startTimeView.frame = startFrame;
    } completion:^(BOOL finished) {
        [_startTimeView removeFromSuperview];
        _startTimeView = nil;
    }];
}
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
    [_noteTextView resignFirstResponder];
    [self setTableFrame:LeftMargin];
    return YES;
}
- (void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView{
    CGFloat offset = ScreenSize.height - TotalHeight - KeyboardHeight;
    if (offset < 0) {//上移
        [self setTableFrame:LeftMargin+offset];
    }
}
- (void)setTableFrame:(CGFloat)tabelH{
    [UIView animateWithDuration:0.25 animations:^{
        CGRect tableFrame = _tableView.frame;
        tableFrame.origin.y = tabelH;
        _tableView.frame = tableFrame;
    }];
}

- (void)keyboardHidden{
    [_titleField resignFirstResponder];
    [_noteTextView resignFirstResponder];
    [self setTableFrame:LeftMargin];
}

n22's avatar
n22 committed
457 458
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
陈俊俊's avatar
陈俊俊 committed
459
    
n22's avatar
n22 committed
460 461
}

陈俊俊's avatar
陈俊俊 committed
462 463 464 465 466
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end