BaseViewController.m 16.8 KB
Newer Older
曹云霄's avatar
曹云霄 committed
1 2 3 4 5 6 7 8 9
//
//  BaseViewController.m
//  Lighting
//
//  Created by 曹云霄 on 16/4/27.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "BaseViewController.h"
10
#import "LoginViewController.h"
曹云霄's avatar
曹云霄 committed
11
#import <WebKit/WebKit.h>
12
#import <AVFoundation/AVFoundation.h>
曹云霄's avatar
曹云霄 committed
13

曹云霄's avatar
曹云霄 committed
14
@interface BaseViewController ()<UIPrintInteractionControllerDelegate,UIWebViewDelegate,WKNavigationDelegate>
15

曹云霄's avatar
曹云霄 committed
16 17

@property (nonatomic,strong) WKWebView *webView;
曹云霄's avatar
曹云霄 committed
18

勾芒's avatar
勾芒 committed
19 20 21 22 23
/**
 *  提示框
 */
@property (nonatomic,strong) PromptinformationView *promptView;

24
@property (nonatomic,strong) UIPrintInteractionController *printControl;
曹云霄's avatar
曹云霄 committed
25 26


曹云霄's avatar
曹云霄 committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40
@end

@implementation BaseViewController


/**
 *  创建MBProgressHUD对象
 *
 *  @return MBProgressHUD
 */
- (MBProgressHUD *)TCHud
{
    if (_TCHud == nil) {
        
曹云霄's avatar
曹云霄 committed
41
        _TCHud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
曹云霄's avatar
曹云霄 committed
42 43 44 45
    }
    return _TCHud;
}

勾芒's avatar
勾芒 committed
46

勾芒's avatar
勾芒 committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
/**
 *  初始化提示框
 *
 *  @return PromptinformationView
 */
- (PromptinformationView *)promptView
{
    if (_promptView == nil) {
        
        _promptView = [[[NSBundle mainBundle] loadNibNamed:@"PromptinformationView" owner:self options:nil] firstObject];
    }
    return _promptView;
}


曹云霄's avatar
曹云霄 committed
62
- (WKWebView *)webView
勾芒's avatar
勾芒 committed
63 64 65
{
    if (_webView == nil) {
        
曹云霄's avatar
曹云霄 committed
66
        _webView = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
勾芒's avatar
勾芒 committed
67 68 69 70
    }
    return _webView;
}

71

勾芒's avatar
勾芒 committed
72

曹云霄's avatar
曹云霄 committed
73 74 75
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
勾芒's avatar
勾芒 committed
76
    self.automaticallyAdjustsScrollViewInsets = NO;
77 78 79 80
    //检测登陆超时通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(logintimeoutNotification:) name:LOGINTIMEOUT object:nil];
}

81

82 83 84
#pragma mark -登陆超时回调
- (void)logintimeoutNotification:(NSNotification *)not
{
85
    WS(weakSelf);
86 87 88 89 90
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"登陆超时,请重新登陆" preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
        [weakSelf dismissViewControllerAnimated:YES completion:nil];
        [Shoppersmanager manager].currentCustomer = NO;
        [Customermanager manager].model = nil;
曹云霄's avatar
曹云霄 committed
91
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"OppleMain" bundle:nil];
92 93 94 95 96 97
        LoginViewController *loginVC = [storyboard instantiateViewControllerWithIdentifier:@"Login"];
        [[NSUserDefaults standardUserDefaults] removeObjectForKey:USERNAME];
        [[NSUserDefaults standardUserDefaults] removeObjectForKey:PASSWORD];
        [weakSelf restoreRootViewController:loginVC];
    }]];
    dispatch_async(dispatch_get_main_queue(), ^{
98
        [weakSelf presentViewController:alert animated:YES completion:nil];
99
    });
曹云霄's avatar
曹云霄 committed
100 101
}

102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

#pragma mark -切换rootViewcontroller
- (void)restoreRootViewController:(UIViewController *)rootViewController
{
    typedef void (^Animation)(void);
    UIWindow* window = SHARED_APPDELEGATE.window;
    rootViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    Animation animation = ^{
        BOOL oldState = [UIView areAnimationsEnabled];
        [UIView setAnimationsEnabled:NO];
        window.rootViewController = rootViewController;
        [UIView setAnimationsEnabled:oldState];
    };
    
    [UIView transitionWithView:window
                      duration:0.5f
                       options:UIViewAnimationOptionTransitionFlipFromBottom
                    animations:animation
                    completion:nil];
曹云霄's avatar
曹云霄 committed
121 122
}

123 124


曹云霄's avatar
曹云霄 committed
125 126 127
#pragma mark -渐隐提示框回调
- (void)SHOWPrompttext:(NSString *)Text ComcpleteBlock:(void(^)())completed
{
128 129
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
    hud.labelText = Text;
曹云霄's avatar
曹云霄 committed
130 131
    hud.animationType = MBProgressHUDAnimationZoom;
    hud.mode = MBProgressHUDModeText;
132
    hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.6];
曹云霄's avatar
曹云霄 committed
133
    hud.removeFromSuperViewOnHide = YES;
134 135
    [hud hide:YES afterDelay:2.0f];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
曹云霄's avatar
曹云霄 committed
136 137 138 139 140 141 142
        if (completed) {
            completed();
        }
    });
}

#pragma mark -显示MBProgressHUD等待视图
143
- (void)CreateMBProgressHUDLoding
曹云霄's avatar
曹云霄 committed
144 145 146
{
    self.TCHud.animationType = MBProgressHUDAnimationZoom;
    self.TCHud.mode = MBProgressHUDModeIndeterminate;
147 148
    self.TCHud.color = [UIColor clearColor];
    self.TCHud.activityIndicatorColor = kMainBlueColor;
曹云霄's avatar
曹云霄 committed
149 150 151
    self.TCHud.removeFromSuperViewOnHide = YES;
}

152 153 154 155 156


#pragma mark -进度条
- (void)ShowProgressView:(double)progress
{
157 158 159 160 161 162 163
    dispatch_async(dispatch_get_main_queue(), ^{
        self.TCHud.mode = MBProgressHUDModeDeterminateHorizontalBar;
        self.TCHud.labelText = @"上传中....";
        self.TCHud.labelFont = [UIFont systemFontOfSize:12];
        self.TCHud.progress = progress;
        self.TCHud.removeFromSuperViewOnHide = YES;
    });
164 165
}

曹云霄's avatar
曹云霄 committed
166
#pragma mark -移除MBProgressHUD等待视图
167
- (void)RemoveMBProgressHUDLoding;
曹云霄's avatar
曹云霄 committed
168
{
169 170 171 172
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.TCHud hide:YES];
        self.TCHud = nil;
    });
曹云霄's avatar
曹云霄 committed
173 174
}

175 176 177 178

#pragma mark -显示成功的提示框
- (void)SuccessMBProgressView:(NSString *)successString
{
179
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
180
    hud.mode = MBProgressHUDModeCustomView;
勾芒's avatar
勾芒 committed
181
    UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
182
    hud.customView = [[UIImageView alloc] initWithImage:image];
183
    hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.6];
184
    hud.labelFont = [UIFont systemFontOfSize:15];
185
    hud.labelText = successString;
186
    [hud hide:YES afterDelay:3];
187 188
}

189
#pragma mark -显示信息的提示框
190 191
- (void)ErrorMBProgressView:(NSString *)errorString
{
192
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
193
    hud.labelText = errorString;
勾芒's avatar
勾芒 committed
194
    hud.margin = 10.f;
195
    hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
196
    hud.minSize = CGSizeMake(250, 70);
勾芒's avatar
勾芒 committed
197 198 199
    hud.animationType = MBProgressHUDAnimationZoom;
    hud.mode = MBProgressHUDModeText;
    hud.removeFromSuperViewOnHide = YES;
200
    [hud hide:YES afterDelay:3.0f];
201 202 203
}


勾芒's avatar
勾芒 committed
204 205 206
#pragma mark -渐隐提示框
- (void)SHOWPrompttext:(NSString *)Text
{
207
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
208
    hud.labelText = Text;
勾芒's avatar
勾芒 committed
209
    hud.margin = 10.f;
210
    hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
勾芒's avatar
勾芒 committed
211
    hud.minSize = CGSizeMake(200, 50);
勾芒's avatar
勾芒 committed
212 213 214
    hud.animationType = MBProgressHUDAnimationZoom;
    hud.mode = MBProgressHUDModeText;
    hud.removeFromSuperViewOnHide = YES;
215
    [hud hide:YES afterDelay:3.0f];
勾芒's avatar
勾芒 committed
216 217 218
}


曹云霄's avatar
曹云霄 committed
219 220 221 222 223 224 225 226 227 228 229 230 231
#pragma mark -结束MJRfresh刷新
- (void)endRefreshingForTableView:(UIScrollView *)TableView
{
    if (TableView.mj_header.isRefreshing) {
        
        [TableView.mj_header endRefreshing];
    }
    else if (TableView.mj_footer.isRefreshing)
    {
        [TableView.mj_footer endRefreshing];
    }
}

曹云霄's avatar
曹云霄 committed
232
#pragma mark -获得我的storyboard对象
曹云霄's avatar
曹云霄 committed
233
+ (UIStoryboard *)getMainStoryboardClass
曹云霄's avatar
曹云霄 committed
234
{
曹云霄's avatar
曹云霄 committed
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"OppleMain" bundle:nil];
    return storyboard;
}

#pragma mark - 获得公告storyboard对象
+ (UIStoryboard *)getAnnouncementStoryboardClass
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Announcement" bundle:nil];
    return storyboard;
}

#pragma mark - 获得学习中心storyboard对象
+ (UIStoryboard *)getLearningCenterStoryboardClass
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"LearningCenter" bundle:nil];
    return storyboard;
}

#pragma mark -获得积分storyboard对象
+ (UIStoryboard *)getGuideIntegralStoryboardClass
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"GuideIntegral" bundle:nil];
曹云霄's avatar
曹云霄 committed
257 258 259
    return storyboard;
}

260 261 262 263 264 265 266 267 268 269 270 271
#pragma mark - 判断相机权限
+ (BOOL)determineCameraPermissions
{
    NSString *mediaType = AVMediaTypeVideo;//读取媒体类型
    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];//读取设备授权状态
    if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){
        return NO;
    }else {
        return YES;
    }
}

曹云霄's avatar
曹云霄 committed
272
#pragma mark 调用airPrint无线打印机
勾芒's avatar
勾芒 committed
273
- (void)callAirprintWithdata:(NSString *)PDFpath SuccessBlock:(void(^)())success ErrorBlock:(void(^)())failed
曹云霄's avatar
曹云霄 committed
274
{
勾芒's avatar
勾芒 committed
275
    NSData *mypdfdata = [NSData dataWithContentsOfFile:PDFpath];
曹云霄's avatar
曹云霄 committed
276 277 278 279 280 281 282 283 284 285
    UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
    if  (pic && [UIPrintInteractionController canPrintData: mypdfdata] ) {
        pic.delegate = self;
        UIPrintInfo *printInfo = [UIPrintInfo printInfo];
        printInfo.outputType = UIPrintInfoOutputGeneral;
        printInfo.jobName = @"订单明细";
        printInfo.duplex = UIPrintInfoDuplexLongEdge;
        pic.printInfo = printInfo;
        pic.showsPageRange = YES;
        pic.printingItem = mypdfdata;
勾芒's avatar
勾芒 committed
286 287 288 289 290 291 292 293 294 295 296
        void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
            if (completed)
            {
                // 执行成功后的处理
                success();
            }
            else if (!completed && error)
            {
                // 执行失败后的处理
                failed();
            }
曹云霄's avatar
曹云霄 committed
297
        };
勾芒's avatar
勾芒 committed
298
        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
曹云霄's avatar
曹云霄 committed
299 300 301 302 303
            [pic presentAnimated:YES completionHandler:completionHandler];
        }
    }
}

曹云霄's avatar
曹云霄 committed
304

勾芒's avatar
勾芒 committed
305
#pragma mark -提示文本,图片
勾芒's avatar
勾芒 committed
306
- (void)PromptinformationViewWithimage:(UIImage *)image withTitle:(NSString *)title withpoint:(CGPoint)point
勾芒's avatar
勾芒 committed
307
{
勾芒's avatar
勾芒 committed
308 309 310 311
    self.promptView.tipsImage.image = image;
    self.promptView.tipsTitle.text = title;
    self.promptView.frame = CGRectMake(point.x, point.y, 250, 170);
    [self.view addSubview:self.promptView];
勾芒's avatar
勾芒 committed
312
}
勾芒's avatar
勾芒 committed
313

314
#pragma mark - 提示框
315
- (void)promptCustomerTitle:(NSString *)title withMessage:(NSString *)message finish:(void (^)())complete
316
{
317 318
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:message preferredStyle:UIAlertControllerStyleAlert];
    [alertVC addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
319 320 321 322 323 324
        if (complete) {
            complete();
        }
    }]];
    [self presentViewController:alertVC animated:YES completion:nil];
}
325

勾芒's avatar
勾芒 committed
326 327 328 329 330 331
#pragma mark -删除提示文本、图片
- (void)RemovePromptinformationView
{
    [self.promptView removeFromSuperview];
    self.promptView = nil;
}
勾芒's avatar
勾芒 committed
332

勾芒's avatar
勾芒 committed
333 334 335
#pragma mark -传入订单状态,返回当前状态图片
+ (UIImage *)ReturnOrderStateImageWithStateCode:(NSInteger)ordercode
{
336
    const NSArray *imageArray = [NSArray arrayWithObjects:@"已撤销",@"已完成",@"已退货", nil];
勾芒's avatar
勾芒 committed
337
    switch (ordercode) {
勾芒's avatar
勾芒 committed
338
        case 4://退货
勾芒's avatar
勾芒 committed
339 340 341 342
        {
            return TCImage([imageArray objectAtIndex_opple:2]);
        }
            break;
勾芒's avatar
勾芒 committed
343
        case 5://作废
勾芒's avatar
勾芒 committed
344 345 346 347
        {
            return TCImage([imageArray objectAtIndex_opple:0]);
        }
            break;
勾芒's avatar
勾芒 committed
348
        case 6://完成
勾芒's avatar
勾芒 committed
349 350 351 352 353 354 355 356 357 358
        {
            return TCImage([imageArray objectAtIndex_opple:1]);
        }
            break;
            
        default:
            break;
    }
    return nil;
}
勾芒's avatar
勾芒 committed
359 360


勾芒's avatar
勾芒 committed
361 362 363
#pragma mark -传入订单状态,返回订单文本信息,字体颜色
+ (id)ReturnOrderStateTitleWithStateCode:(NSInteger)ordercode withPoint:(CGPoint)point WithCode:(NSInteger)code
{
364
    
勾芒's avatar
勾芒 committed
365 366 367 368 369 370
    switch (ordercode) {
        case 001://未付款
        {
            if (code) {
                return kTCColor(241, 81, 83);
            }
曹云霄's avatar
曹云霄 committed
371
            return @"待支付";
勾芒's avatar
勾芒 committed
372 373 374 375
        }
            break;
        case 002://已付款
        {
376
            
勾芒's avatar
勾芒 committed
377 378 379
            if (code) {
                return kTCColor(126, 191, 53);
            }
380
            return @"已支付";
勾芒's avatar
勾芒 committed
381 382 383 384
        }
            break;
        case 003://已发货
        {
385
            
勾芒's avatar
勾芒 committed
386 387 388 389 390 391 392 393
            if (code) {
                return kTCColor(240, 180, 51);
            }
            return @"已发货";
        }
            break;
        case 004://已退货
        {
394
            
勾芒's avatar
勾芒 committed
395 396 397 398 399 400 401 402
            if (code) {
                return kTCColor(153, 153, 153);
            }
            return @"已退货";
        }
            break;
        case 005://已作废
        {
403
            
勾芒's avatar
勾芒 committed
404 405 406
            if (code) {
                return kTCColor(153, 153, 153);
            }
勾芒's avatar
勾芒 committed
407
            return @"已撤销";
勾芒's avatar
勾芒 committed
408 409 410 411
        }
            break;
        case 006://已完成
        {
412
            
勾芒's avatar
勾芒 committed
413 414 415 416 417 418 419 420 421 422 423 424
            if (code) {
                return kTCColor(89, 172, 220);
            }
            return @"已完成";
        }
            break;
            
        default:
            break;
    }
    return nil;
}
勾芒's avatar
勾芒 committed
425

勾芒's avatar
勾芒 committed
426 427 428
#pragma mark -查询购物车数量
- (void)QueryShoppingCarNumber
{
429
    WS(weakSelf);
430
    [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@",SERVERREQUESTURL(QUERYSHOPPINGBAGNUMBER),[Customermanager manager].model.fid] WithCallClass:weakSelf WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
勾芒's avatar
勾芒 committed
431 432 433
        
        if ([returnValue[@"code"] isEqualToNumber:@0]) {
            NSLog(@"更新购物车数量成功");
434
            [[NSNotificationCenter defaultCenter]postNotificationName:ADDSHOPPINGCAR object:returnValue[@"data"]];
勾芒's avatar
勾芒 committed
435 436
        }
    } WithErrorCodeBlock:^(id errorCodeValue) {
437 438 439
        [weakSelf RemoveMBProgressHUDLoding];
        [weakSelf ErrorMBProgressView:@"无网络"];
    } WithFailureBlock:^(NSError *error) {
勾芒's avatar
勾芒 committed
440
        NSLog(@"更新购物车数量失败");
441
        [weakSelf ErrorMBProgressView:error.localizedDescription];
勾芒's avatar
勾芒 committed
442 443 444
    }];
}

445 446 447 448 449
#pragma mark - 查询购物车商品
- (void)queryShoppingCarGoods
{
    [[NSNotificationCenter defaultCenter] postNotificationName:SHOPPINGCARGOODS object:nil];
}
勾芒's avatar
勾芒 committed
450

勾芒's avatar
勾芒 committed
451 452 453 454 455 456 457 458
#pragma mark -系统提示框
- (void)promptCustomerWithString:(NSString *)message
{
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:message preferredStyle:UIAlertControllerStyleAlert];
    [alertVC addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        [self dismissViewControllerAnimated:YES completion:nil];
    }]];
曹云霄's avatar
曹云霄 committed
459 460 461
    dispatch_async(dispatch_get_main_queue(), ^{
        [self presentViewController:alertVC animated:YES completion:nil];
    });
勾芒's avatar
勾芒 committed
462 463
}

464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
#pragma mark -友好化时间
+ (NSString *) compareCurrentTime:(NSString *)str
{
    
    //把字符串转为NSdate
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSS"];
    NSDate *timeDate = [dateFormatter dateFromString:str];
    
    //得到与当前时间差
    NSTimeInterval  timeInterval = [timeDate timeIntervalSinceNow];
    timeInterval = -timeInterval;
    //标准时间和北京时间差8个小时
    timeInterval = timeInterval - 8*60*60;
    long temp = 0;
    NSString *result;
    if (timeInterval < 60) {
        result = [NSString stringWithFormat:@"刚刚"];
    }
    else if((temp = timeInterval/60) <60){
        result = [NSString stringWithFormat:@"%ld分钟前",temp];
    }
    
    else if((temp = temp/60) <24){
        result = [NSString stringWithFormat:@"%ld小时前",temp];
    }
    
    else if((temp = temp/24) <30){
        result = [NSString stringWithFormat:@"%ld天前",temp];
    }
    
    else if((temp = temp/30) <12){
        result = [NSString stringWithFormat:@"%ld月前",temp];
    }
    else{
        temp = temp/12;
        result = [NSString stringWithFormat:@"%ld年前",temp];
    }
    
    return  result;
}
勾芒's avatar
勾芒 committed
505

506 507 508 509 510 511 512
#pragma mark - 获取版本号
- (NSString*)getAppVersion
{
    NSString *ver = [[[NSBundle mainBundle] infoDictionary]
                     objectForKey:@"CFBundleShortVersionString"];
    return [NSString stringWithFormat:@"Version %@",ver];
}
勾芒's avatar
勾芒 committed
513

514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
#pragma mark - 通过面额获取相应的图片
+ (UIImage *)getCorrespondingPictures:(NSInteger)total
{
    UIImage *image = nil;
    switch (total) {
        case 50:
        {
            image = TCImage(@"fifty");
        }
            break;
        case 100:
        {
            image = TCImage(@"onehundred");
        }
            break;
        case 200:
        {
            image = TCImage(@"twohundred");
        }
            break;
            
        default:
            break;
    }
    return image;
}

+ (BOOL)isBlankString:(NSString *)string
{
    if (string == nil || string == NULL) {
        return YES;
    }
    if ([string isKindOfClass:[NSNull class]]) {
        return YES;
    }
    if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) {
        return YES;
    }
    return NO;
}


556 557
- (void)dealloc
{
558
    NSLog(@"释放%@控制器",self);
559 560
}

勾芒's avatar
勾芒 committed
561

勾芒's avatar
勾芒 committed
562 563 564



曹云霄's avatar
曹云霄 committed
565
@end