admin
2023-04-21 0b3a4aaf99ea251bc8e27b96115288f0988fcffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//
//  UIViewController+Tools.m
//  MoodDiary
//
//  Created by rimi on 16/7/11.
//  Copyright © 2016年 cym. All rights reserved.
//
 
#import "UIViewController+Tools.h"
#import "UIImageView+WebCache.h"
#define Version [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]  //build号
#define Package @"com.haicaojie-ios"  //相当于包名
@implementation UIViewController (Tools)
 
// alert自动消失
- (void)autoDisappearAlertTime:(CGFloat)time msg:(NSString *)msg {
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:msg preferredStyle:UIAlertControllerStyleAlert];
    [self presentViewController:alert animated:YES completion:^{
        //延时执行
        dispatch_queue_t q = dispatch_get_main_queue();
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, time * NSEC_PER_SEC), q, ^{
            [alert dismissViewControllerAnimated:YES completion:nil];
        });
    }];
}
 
 
@end