Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Open source
Business
Explore
Pricing
Blog
Support
This repository
b / WPSKit
Watch
kir yt
de
es
Co
Issu
anch: master
Br
kir yt
Search
PSKit
Pull
e e
r qu sts
ects
Proj
Puls
Sign in
ar
44
St
aphs
Fin
d file
bce9d6don
1 contributor
//
//WPSAlertController.h
//
//CreatedbyKirbyTurner.
//Copyright2015WhitePeakSoftware.Allrightsreserved.
//
//Permissionisherebygranted,freeofcharge,toanypersonobtaining
//acopyofthissoftwareandassociateddocumentationfiles(the
//"Software"),todealintheSoftwarewithoutrestriction,including
10
//withoutlimitationtherightstouse,copy,modify,merge,publish,
11
//distribute,sublicense,and/orsellcopiesoftheSoftware,andtopermit
12
//personstowhomtheSoftwareisfurnishedtodoso,subjecttothe
13
//followingconditions:
14
//
15
//Theabovecopyrightnoticeandthispermissionnoticeshallbeincluded
16
//inallcopiesorsubstantialportionsoftheSoftware.
17
//
Fork
Gr
85lines(71sloc) 2.95KB
Sign up
aw
ame
Bl
History
Copy
p th
ep 27, 2015
18
//THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOFANYKIND,EXPRESS
19
//ORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOF
20
//MERCHANTABILITY,FITNESSFORAPARTICULARPURPOSEANDNONINFRINGEMENT.
21
//INNOEVENTSHALLTHEAUTHORSORCOPYRIGHTHOLDERSBELIABLEFORANY
22
//CLAIM,DAMAGESOROTHERLIABILITY,WHETHERINANACTIONOFCONTRACT,
23
//TORTOROTHERWISE,ARISINGFROM,OUTOFORINCONNECTIONWITHTHE
24
//SOFTWAREORTHEUSEOROTHERDEALINGSINTHESOFTWARE.
25
//
26
27
#import"WPSAlertController.h"
28
29
@interfaceWPSAlertController()
30
@property(nonatomic,strong)UIWindow*alertWindow;
31
@end
32
33
@implementationWPSAlertController
34
35
(void)viewDidLoad
36
37
[superviewDidLoad];
38
//Doanyadditionalsetupafterloadingtheview.
39
40
41
(void)viewDidDisappear:(BOOL)animated
42
43
[superviewDidDisappear:animated];
44
[[selfalertWindow]setHidden:YES];
45
[selfsetAlertWindow:nil];
46
47
48
(void)show
49
50
[selfshowAnimated:YES];
51
52
53
(void)showAnimated:(BOOL)animated
54
55
UIViewController*blankViewController=[[UIViewControlleralloc]init];
56
[[blankViewControllerview]setBackgroundColor:[UIColorclearColor]];
57
58
UIWindow*window=[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];
59
[windowsetRootViewController:blankViewController];
60
[windowsetBackgroundColor:[UIColorclearColor]];
61
[windowsetWindowLevel:UIWindowLevelAlert+1];
62
[windowmakeKeyAndVisible];
63
[selfsetAlertWindow:window];
64
65
[blankViewControllerpresentViewController:selfanimated:animatedcompletion:nil];
66
67
68
+(void)presentOkayAlertWithTitle:(nullableNSString*)titlemessage:(nullableNSString*)message
69
70
WPSAlertController*alertController=[WPSAlertControlleralertControllerWithTitle:titlemessage:messagepreferredStyle:UIAlertControllerStyleAlert]
71
UIAlertAction*okayAction=[UIAlertActionactionWithTitle:NSLocalizedStringFromTable(@"OK",@"WPSKit",@"Alertbuttontitle")style:UIAlertActionSt
72
[alertControlleraddAction:okayAction];
73
74
[alertControllershow];
75
76
77
+(void)presentOkayAlertWithError:(nullableNSError*)error
78
79
NSString*title=NSLocalizedStringFromTable(@"Error",@"WPSKit",@"Alerttitle.");
80
NSString*message=[errorlocalizedDescription];
81
[[selfclass]presentOkayAlertWithTitle:titlemessage:message];
82
83
84
@end
Terms
acy
Priv
ecurity
atus
St
elp
act GitHub
Cont
API
Training
Shop
Blog
bout