ZZPhotoPickerViewController.m
20.6 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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
208
209
210
211
212
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
244
245
246
247
248
249
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
287
288
289
290
291
292
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
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
410
411
412
413
414
415
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
457
458
459
460
461
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
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
//
// ZZPhotoPickerViewController.m
// ZZFramework
//
// Created by Yuan on 15/7/7.
// Copyright (c) 2015年 zzl. All rights reserved.
//
#import "Masonry.h"
#import "ZZPhotoPickerViewController.h"
#import "ZZPhotoDatas.h"
#import "ZZPhotoPickerCell.h"
#import "ZZPhotoBrowerViewController.h"
#import "ZZPhotoHud.h"
#import "ZZAlumAnimation.h"
#import "ZZPhoto.h"
@interface ZZPhotoPickerViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,ZZPhotoBrowerDataSource>
@property (strong, nonatomic) NSMutableArray *photoArray;
@property (strong, nonatomic) UICollectionView *picsCollection;
@property (strong, nonatomic) UIButton *selectBtn;
@property (assign, nonatomic) BOOL isSelect;
@property (strong, nonatomic) UIBarButtonItem *backBtn;
@property (strong, nonatomic) UIBarButtonItem *cancelBtn;
@property (strong, nonatomic) UIButton *doneBtn; //完成按钮
@property (strong, nonatomic) UIButton *previewBtn; //预览按钮
@property (strong, nonatomic) UILabel *totalNumLabel;
@property (strong, nonatomic) UILabel *totalRound; //小红点
@property (strong, nonatomic) ZZPhotoDatas *datas;
@property (strong, nonatomic) ZZPhotoBrowerViewController *browserController;
@property (strong, nonatomic) UILabel *numSelectLabel;
@end
@implementation ZZPhotoPickerViewController
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
#pragma SETUP backButtonUI Method
- (UIBarButtonItem *)backBtn{
if (!_backBtn) {
//备注:张明 2016-06-24
UIButton *back_btn = [UIButton buttonWithType:UIButtonTypeCustom];
back_btn.frame = CGRectMake(0, 0, 40, 40);
[back_btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchDown];
UIImageView *imgLeft = [[UIImageView alloc]init];
[back_btn addSubview:imgLeft];
[imgLeft mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(back_btn.mas_left);
make.centerY.mas_equalTo(back_btn.mas_centerY);
make.width.mas_equalTo(@12);
make.height.mas_equalTo(@20);
}];
[imgLeft setImage:[UIImage imageNamed:@"xn talk-ios-37"]];
_backBtn = [[UIBarButtonItem alloc] initWithCustomView:back_btn];
// negativeSpace.width = -20;
// self.navigationItem.leftBarButtonItem = left;
// [self.navigationItem setHidesBackButton:YES];
// UIButton *back_btn = [UIButton buttonWithType:UIButtonTypeCustom];//WithFrame:CGRectMake(0, 0, 45, 44)];
// [back_btn setImage:[UIImage imageNamed:@"xn talk-ios-37"] forState:UIControlStateNormal];
// [back_btn setImage:[UIImage imageNamed:@"xn talk-ios-37"] forState:UIControlStateHighlighted];
// back_btn.frame = CGRectMake(-22, 0, 24, 44);
// [back_btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
// _backBtn = [[UIBarButtonItem alloc] initWithCustomView:back_btn];
}
return _backBtn;
}
#pragma SETUP cancelButtonUI Method
- (UIBarButtonItem *)cancelBtn{
if (!_cancelBtn) {
UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 30)];
[button addTarget:self action:@selector(cancel) forControlEvents:UIControlEventTouchUpInside];
button.titleLabel.font = [UIFont systemFontOfSize:17.0f];
// [button.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:17]];
[button setTitle:CustomStr(@"取消") forState:UIControlStateNormal];
[button setTitleColor:COLOR_S_WHITE forState:UIControlStateNormal];
[button sizeToFit];
_cancelBtn = [[UIBarButtonItem alloc] initWithCustomView:button];
}
return _cancelBtn;
}
#pragma mark SETUP doneButtonUI Method
-(UIButton *)doneBtn{
if (!_doneBtn) {
_doneBtn = [[UIButton alloc]initWithFrame:CGRectMake(ZZ_VW - 60, 0, 50, 44)];
[_doneBtn addTarget:self action:@selector(done) forControlEvents:UIControlEventTouchUpInside];
_doneBtn.titleLabel.font = [UIFont systemFontOfSize:14.0f];
// [_doneBtn.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:17]];
[_doneBtn setTitle:CustomStr(@"完成") forState:UIControlStateNormal];
[_doneBtn setTitleColor:COLOR_S_LIGHTGRAY forState:UIControlStateNormal];
[_doneBtn setEnabled:NO];
if (_selectArray.count >0) {
[_doneBtn setTitleColor:COLOR_C_mainColor forState:UIControlStateNormal];
[_doneBtn setEnabled:YES];
}
}
return _doneBtn;
}
#pragma merk SETUP previewButtonUI Method
-(UIButton *)previewBtn{
if (!_previewBtn) {
_previewBtn = [[UIButton alloc]initWithFrame:CGRectMake(10, 0, 70, 44)];
[_previewBtn addTarget:self action:@selector(preview) forControlEvents:UIControlEventTouchUpInside];
_previewBtn.titleLabel.font = [UIFont systemFontOfSize:14.0f];
[_previewBtn setTitle:CustomStr(@"预览") forState:UIControlStateNormal];
[_previewBtn setTitleColor:COLOR_S_LIGHTGRAY forState:UIControlStateNormal];
[_previewBtn setEnabled:NO];
if (_selectArray.count>0) {
[_previewBtn setEnabled:YES];
[_previewBtn setTitleColor:COLOR_C_mainColor forState:UIControlStateNormal];
}
}
return _previewBtn;
}
-(void)back{
[self.navigationController popViewControllerAnimated:YES];
}
-(void)cancel{
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark --- 完成然后回调
-(void)done{
if ([self.selectArray count] == 0) {
[_doneBtn setTitleColor:COLOR_S_LIGHTGRAY forState:UIControlStateNormal];
[_doneBtn setEnabled:NO];
// [self dismissViewControllerAnimated:YES completion:nil];
}else{
[_doneBtn setTitleColor:COLOR_C_mainColor forState:UIControlStateNormal];
[_doneBtn setEnabled:YES];
NSMutableArray<ZZPhoto *> *photos = [NSMutableArray array];
for (int i = 0; i < self.selectArray.count; i++) {
ZZPhoto *photo = [self.selectArray objectAtIndex:i];
[self.datas GetImageObject:photo.asset complection:^(UIImage *image,NSURL *imageUrl) {
if (image){
ZZPhoto *model = [[ZZPhoto alloc]init];
model.asset = photo.asset;
model.originImage = image;
model.imageUrl = imageUrl;
model.createDate = photo.asset.creationDate;
[photos addObject:model];
}
if (photos.count < self.selectArray.count){
return;
}
if (self.PhotoResult) {
self.PhotoResult(photos);
}
[self dismissViewControllerAnimated:YES completion:nil];
}];
}
}
}
//预览按钮,弹出图片浏览器
-(void)preview{
if (self.selectArray.count == 0) {
[_previewBtn setTitleColor:COLOR_S_LIGHTGRAY forState:UIControlStateNormal];
[_previewBtn setEnabled:NO];
// [self showPhotoPickerAlertView:@"提醒" message:@"您还没有选中图片,不需要预览"];
}else{
[_previewBtn setTitleColor:COLOR_C_mainColor forState:UIControlStateNormal];
[_previewBtn setEnabled:YES];
self.browserController = [[ZZPhotoBrowerViewController alloc]init];
self.browserController.delegate = self;
[self.browserController reloadData];
[self.browserController showIn:self];
}
}
#pragma Declaration Array
-(NSMutableArray *)photoArray
{
if (!_photoArray) {
_photoArray = [NSMutableArray array];
}
return _photoArray;
}
-(NSMutableArray *)selectArray
{
if (!_selectArray) {
_selectArray = [NSMutableArray array];
}
return _selectArray;
}
#pragma mark --- 懒加载图片数据
-(ZZPhotoDatas *)datas{
if (!_datas) {
_datas = [[ZZPhotoDatas alloc]init];
}
return _datas;
}
#pragma mark --- 总共多少张照片Label
-(UILabel *)totalNumLabel{
if (!_totalNumLabel) {
_totalNumLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 20, ZZ_VW, 20)];
_totalNumLabel.textColor = [UIColor blackColor];
_totalNumLabel.textAlignment = NSTextAlignmentCenter;
}
return _totalNumLabel;
}
#pragma mark --- 蓝色小圆点
-(UILabel *)totalRound{
if (!_totalRound) {
//备注:张明 2016-06-24 修改坐标
_totalRound = [[UILabel alloc]initWithFrame:CGRectMake(ZZ_VW - 75, 10, 22, 22)];
if (self.roundColor == nil) {
_totalRound.backgroundColor = COLOR_C_mainColor;
}else{
_totalRound.backgroundColor = self.roundColor;
}
_totalRound.layer.masksToBounds = YES;
_totalRound.textAlignment = NSTextAlignmentCenter;
_totalRound.textColor = [UIColor whiteColor];
_totalRound.text = [NSString stringWithFormat:@"%lu",(unsigned long)self.selectArray.count];
[_totalRound.layer setCornerRadius:CGRectGetHeight([_totalRound bounds]) / 2];
}
return _totalRound;
}
-(void)setUpTabbar
{
UIView *view = [[UIView alloc]initWithFrame:CGRectZero];
view.backgroundColor = ZZ_RGB(245, 245, 245);
view.translatesAutoresizingMaskIntoConstraints = NO;
[view addSubview:self.doneBtn];
[view addSubview:self.previewBtn];
[view addSubview:self.totalRound];
[self.view addSubview:view];
UIView *viewLine = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ZZ_VW, 1)];
viewLine.backgroundColor = ZZ_RGB(230, 230, 230);
[view addSubview:viewLine];
NSLayoutConstraint *tab_bottom = [NSLayoutConstraint constraintWithItem:_picsCollection attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeTop multiplier:1 constant:0.0f];
NSLayoutConstraint *tab_width = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:ZZ_VW];
NSLayoutConstraint *tab_height = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:44];
[self.view addConstraints:@[tab_bottom,tab_width,tab_height]];
}
-(void)setupCollectionViewUI
{
self.edgesForExtendedLayout = UIRectEdgeNone;
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
CGFloat photoSize = ([UIScreen mainScreen].bounds.size.width - 3) / 4;
flowLayout.minimumInteritemSpacing = 1.0;//item 之间的行的距离
flowLayout.minimumLineSpacing = 1.0;//item 之间竖的距离
flowLayout.itemSize = (CGSize){photoSize,photoSize};
// self.sectionInset = UIEdgeInsetsMake(0, 2, 0, 0);
flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
_picsCollection = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:flowLayout];
[_picsCollection registerClass:[ZZPhotoPickerCell class] forCellWithReuseIdentifier:@"PhotoPickerCell"];
[_picsCollection registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"FooterView"];
flowLayout.footerReferenceSize = CGSizeMake(ZZ_VW, 70);
_picsCollection.delegate = self;
_picsCollection.dataSource = self;
_picsCollection.backgroundColor = [UIColor whiteColor];
[_picsCollection setUserInteractionEnabled:YES];
_picsCollection.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_picsCollection];
[_picsCollection reloadData];
NSLayoutConstraint *pic_top = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_picsCollection attribute:NSLayoutAttributeTop multiplier:1 constant:0.0f];
NSLayoutConstraint *pic_bottom = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:_picsCollection attribute:NSLayoutAttributeBottom multiplier:1 constant:44.0f];
NSLayoutConstraint *pic_left = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_picsCollection attribute:NSLayoutAttributeLeft multiplier:1 constant:0.0f];
NSLayoutConstraint *pic_right = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:_picsCollection attribute:NSLayoutAttributeRight multiplier:1 constant:0.0f];
[self.view addConstraints:@[pic_top,pic_bottom,pic_left,pic_right]];
}
-(void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
//滚动到底部
if (self.photoArray.count != 0) {
[_picsCollection scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:self.photoArray.count - 1 inSection:0] atScrollPosition:UICollectionViewScrollPositionBottom animated:NO];
}
}
- (void)initInterUI
{
self.automaticallyAdjustsScrollViewInsets = NO;
self.view.backgroundColor = [UIColor whiteColor];
// self.navigationItem.leftBarButtonItem = self.backBtn;
self.navigationItem.rightBarButtonItem = self.cancelBtn;
}
#pragma mark - view加载
- (void)viewDidLoad {
[super viewDidLoad];
[self initInterUI];
[self loadPhotoData];
// 更新UI
[self setupCollectionViewUI];
//创建底部工具栏
[self setUpTabbar];
//备注:张明 2016-06-24
self.navigationItem.title = CustomStr(@"所有照片");
//设置导航条标题字体颜色
self.navigationController.navigationBar.titleTextAttributes =[NSDictionary dictionaryWithObject:COLOR_S_WHITE forKey:NSForegroundColorAttributeName];
[self.navigationController.navigationBar setBarTintColor:COLOR_C_NAVColor];
}
-(void)loadPhotoData
{
if (_isAlubSeclect == YES) {
self.photoArray = [self.datas GetPhotoAssets:_fetch];
[self refreshTotalNumLabelData:_photoArray.count];
}else{
self.navigationItem.title = CustomStr(@"所有照片");
//设置导航条标题字体颜色
self.navigationController.navigationBar.titleTextAttributes =[NSDictionary dictionaryWithObject:COLOR_S_WHITE forKey:NSForegroundColorAttributeName];
self.photoArray = [self.datas GetPhotoAssets:[self.datas GetCameraRollFetchResul]];
[self refreshTotalNumLabelData:_photoArray.count];
}
}
-(void)refreshTotalNumLabelData:(NSInteger)totalNum
{
self.totalNumLabel.text = [NSString stringWithFormat:@"%ld%@",(long)totalNum,CustomStr(@"张照片")];
}
#pragma mark 关键位置,选中的在数组中添加,取消的从数组中减少
-(void)selectPicBtn:(UIButton *)button
{
NSInteger index = button.tag;
if (button.selected == NO)
{
//设置预览、上传是否可点
[_doneBtn setTitleColor:COLOR_C_mainColor forState:UIControlStateNormal];
[_doneBtn setEnabled:YES];
[_previewBtn setTitleColor:COLOR_C_mainColor forState:UIControlStateNormal];
[_previewBtn setEnabled:YES];
[[ZZAlumAnimation sharedAnimation] selectAnimation:button];
if (self.selectArray.count + 1 > _selectNum)
{
[self showSelectPhotoAlertView:_selectNum];
}
else{
[self.selectArray addObject:[self.photoArray objectAtIndex:index]];
[[ZZAlumAnimation sharedAnimation] roundAnimation:self.totalRound];
self.totalRound.text = [NSString stringWithFormat:@"%lu",(unsigned long)self.selectArray.count];
[button setImage:Pic_Btn_Selected forState:UIControlStateNormal];
button.selected = YES;
}
}
else{
//设置预览、上传是否可点
[[ZZAlumAnimation sharedAnimation] selectAnimation:button];
[self.selectArray removeObject:[self.photoArray objectAtIndex:index]];
[[ZZAlumAnimation sharedAnimation] roundAnimation:self.totalRound];
self.totalRound.text = [NSString stringWithFormat:@"%lu",(unsigned long)self.selectArray.count];
if (self.selectArray.count < 1) {
[_doneBtn setTitleColor:COLOR_S_LIGHTGRAY forState:UIControlStateNormal];
[_doneBtn setEnabled:NO];
[_previewBtn setTitleColor:COLOR_S_LIGHTGRAY forState:UIControlStateNormal];
[_previewBtn setEnabled:NO];
}
[button setImage:Pic_btn_UnSelected forState:UIControlStateNormal];
button.selected = NO;
}
}
#pragma UICollectionView --- Datasource
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return self.photoArray.count;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
ZZPhotoPickerCell *photoCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoPickerCell" forIndexPath:indexPath];
photoCell.selectBtn.tag = indexPath.row;
[photoCell.selectBtn addTarget:self action:@selector(selectPicBtn:) forControlEvents:UIControlEventTouchUpInside];
[photoCell loadPhotoData:[self.photoArray objectAtIndex:indexPath.row]];
[photoCell selectBtnStage:self.selectArray existence:[self.photoArray objectAtIndex:indexPath.row]];
return photoCell;
}
#pragma UICollectionView --- Delegate
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *footerView = [[UICollectionReusableView alloc]init];
footerView.backgroundColor = [UIColor redColor];
if (kind == UICollectionElementKindSectionFooter){
footerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"FooterView" forIndexPath:indexPath];
}
[footerView addSubview:self.totalNumLabel];
return footerView;
}
-(BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
/*
* 此功能未完成,待后期完善。
*/
for (ZZPhotoPickerCell *photoCell in collectionView.visibleCells) {
if (indexPath.item == photoCell.selectBtn.tag) {
[self selectPicBtn:photoCell.selectBtn];
}
}
// [self.browserDataArray removeAllObjects];
// [self.browserDataArray addObjectsFromArray:self.photoArray];
// self.browserController.indexPath = indexPath;
// [self.browserController showIn:self animation:ShowAnimationOfPresent];
// [self.browserController reloadData];
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
{
return CGSizeMake(self.view.frame.size.width, 60);
}
#pragma mark --- ZZBrowserPickerDelegate
-(NSInteger)zzbrowserPickerPhotoNum:(ZZPhotoBrowerViewController *)controller
{
return self.selectArray.count;
}
-(NSArray *)zzbrowserPickerPhotoContent:(ZZPhotoBrowerViewController *)controller
{
return self.selectArray;
}
-(void)showSelectPhotoAlertView:(NSInteger)photoNumOfMax
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"提醒") message:[NSString stringWithFormat:@"%@%ld%@",CustomStr(@"最多只能选择"),(long)photoNumOfMax,CustomStr(@"张图片")]preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"确定") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){
}];
[alert addAction:action1];
[self presentViewController:alert animated:YES completion:nil];
}
-(void)showPhotoPickerAlertView:(NSString *)title message:(NSString *)message
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"确定") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){
}];
[alert addAction:action1];
[self presentViewController:alert animated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end