Няма описание

LGAlertView.h 47KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. //
  2. // LGAlertView.h
  3. // LGAlertView
  4. //
  5. //
  6. // The MIT License (MIT)
  7. //
  8. // Copyright © 2015 Grigory Lutkov <Friend.LGA@gmail.com>
  9. // (https://github.com/Friend-LGA/LGAlertView)
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining a copy
  12. // of this software and associated documentation files (the "Software"), to deal
  13. // in the Software without restriction, including without limitation the rights
  14. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. // copies of the Software, and to permit persons to whom the Software is
  16. // furnished to do so, subject to the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be included in all
  19. // copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  27. // SOFTWARE.
  28. //
  29. #import <UIKit/UIKit.h>
  30. #import "LGAlertViewButtonProperties.h"
  31. #import "LGAlertViewShared.h"
  32. @class LGAlertView;
  33. @protocol LGAlertViewDelegate;
  34. #pragma mark - Constants
  35. extern NSString * _Nonnull const LGAlertViewWillShowNotification;
  36. extern NSString * _Nonnull const LGAlertViewDidShowNotification;
  37. extern NSString * _Nonnull const LGAlertViewWillDismissNotification;
  38. extern NSString * _Nonnull const LGAlertViewDidDismissNotification;
  39. extern NSString * _Nonnull const LGAlertViewActionNotification;
  40. extern NSString * _Nonnull const LGAlertViewCancelNotification;
  41. extern NSString * _Nonnull const LGAlertViewDestructiveNotification;
  42. extern NSString * _Nonnull const LGAlertViewDidDismissAfterActionNotification;
  43. extern NSString * _Nonnull const LGAlertViewDidDismissAfterCancelNotification;
  44. extern NSString * _Nonnull const LGAlertViewDidDismissAfterDestructiveNotification;
  45. /** You can use this notification to add some custom animations */
  46. extern NSString * _Nonnull const LGAlertViewShowAnimationsNotification;
  47. /** You can use this notification to add some custom animations */
  48. extern NSString * _Nonnull const LGAlertViewDismissAnimationsNotification;
  49. extern NSString * _Nonnull const kLGAlertViewAnimationDuration;
  50. #pragma mark - Types
  51. typedef void (^ _Nullable LGAlertViewCompletionHandler)();
  52. typedef void (^ _Nullable LGAlertViewHandler)(LGAlertView * _Nonnull alertView);
  53. typedef void (^ _Nullable LGAlertViewActionHandler)(LGAlertView * _Nonnull alertView, NSUInteger index, NSString * _Nullable title);
  54. typedef void (^ _Nullable LGAlertViewTextFieldsSetupHandler)(UITextField * _Nonnull textField, NSUInteger index);
  55. typedef void (^ _Nullable LGAlertViewAnimationsBlock)(LGAlertView * _Nonnull alertView, NSTimeInterval duration);
  56. typedef NS_ENUM(NSUInteger, LGAlertViewStyle) {
  57. LGAlertViewStyleAlert = 0,
  58. LGAlertViewStyleActionSheet = 1
  59. };
  60. typedef NS_ENUM(NSUInteger, LGAlertViewWindowLevel) {
  61. LGAlertViewWindowLevelAboveStatusBar = 0,
  62. LGAlertViewWindowLevelBelowStatusBar = 1
  63. };
  64. #pragma mark -
  65. @interface LGAlertView : NSObject <UIAppearance>
  66. /** Is action "show" already had been executed */
  67. @property (assign, nonatomic, readonly, getter=isShowing) BOOL showing;
  68. /** Is alert view visible right now */
  69. @property (assign, nonatomic, readonly, getter=isVisible) BOOL visible;
  70. @property (assign, nonatomic, readonly) LGAlertViewStyle style;
  71. /** Default is LGAlertViewWindowLevelAboveStatusBar */
  72. @property (assign, nonatomic) LGAlertViewWindowLevel windowLevel UI_APPEARANCE_SELECTOR;
  73. /**
  74. Default:
  75. if (alert with activityIndicator || progressView || textFields) then NO
  76. else YES
  77. */
  78. @property (assign, nonatomic, getter=isCancelOnTouch) BOOL cancelOnTouch UI_APPEARANCE_SELECTOR;
  79. /**
  80. Dismiss alert view on action, cancel and destructive
  81. Default is YES
  82. */
  83. @property (assign, nonatomic, getter=isDismissOnAction) BOOL dismissOnAction UI_APPEARANCE_SELECTOR;
  84. @property (copy, nonatomic, readonly, nullable) NSArray *textFieldsArray;
  85. /** View that you associate to alert view while initialization */
  86. @property (strong, nonatomic, readonly, nullable) UIView *innerView;
  87. /** Default is 0 */
  88. @property (assign, nonatomic) NSInteger tag;
  89. #pragma mark - Style properties
  90. /**
  91. Set colors of buttons title and highlighted background, cancel button title and highlighted background, activity indicator and progress view
  92. Default is [UIColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:1.0]
  93. */
  94. @property (strong, nonatomic, nullable) UIColor *tintColor UI_APPEARANCE_SELECTOR;
  95. /**
  96. Color hides main view when alert view is showing
  97. Default is [UIColor colorWithWhite:0.0 alpha:0.35]
  98. */
  99. @property (strong, nonatomic, nullable) UIColor *coverColor UI_APPEARANCE_SELECTOR;
  100. /** Default is nil */
  101. @property (strong, nonatomic, nullable) UIBlurEffect *coverBlurEffect UI_APPEARANCE_SELECTOR;
  102. /** Default is 1.0 */
  103. @property (assign, nonatomic) CGFloat coverAlpha UI_APPEARANCE_SELECTOR;
  104. /** Default is UIColor.whiteColor */
  105. @property (strong, nonatomic, nullable) UIColor *backgroundColor UI_APPEARANCE_SELECTOR;
  106. /** Default is nil */
  107. @property (strong, nonatomic, nullable) UIBlurEffect *backgroundBlurEffect UI_APPEARANCE_SELECTOR;
  108. /**
  109. Default:
  110. if (style == LGAlertViewStyleAlert || iOS < 9.0) then 44.0
  111. else 56.0
  112. */
  113. @property (assign, nonatomic) CGFloat buttonsHeight UI_APPEARANCE_SELECTOR;
  114. /** Default is 44.0 */
  115. @property (assign, nonatomic) CGFloat textFieldsHeight UI_APPEARANCE_SELECTOR;
  116. /**
  117. Top and bottom offsets from borders of the screen
  118. Default is 8.0
  119. */
  120. @property (assign, nonatomic) CGFloat offsetVertical UI_APPEARANCE_SELECTOR;
  121. /**
  122. Offset between cancel button and main view when style is LGAlertViewStyleActionSheet
  123. Default is 8.0
  124. */
  125. @property (assign, nonatomic) CGFloat cancelButtonOffsetY UI_APPEARANCE_SELECTOR;
  126. /** Default is NSNotFound */
  127. @property (assign, nonatomic) CGFloat heightMax UI_APPEARANCE_SELECTOR;
  128. /**
  129. Default:
  130. if (style == LGAlertViewStyleAlert) then 280.0
  131. else if (iPad) then 304.0
  132. else window.width - 16.0
  133. */
  134. @property (assign, nonatomic) CGFloat width UI_APPEARANCE_SELECTOR;
  135. /** Default is [UIColor colorWithWhite:0.85 alpha:1.0] */
  136. @property (strong, nonatomic, nullable) UIColor *separatorsColor UI_APPEARANCE_SELECTOR;
  137. /** Default is UIScrollViewIndicatorStyleBlack */
  138. @property (assign, nonatomic) UIScrollViewIndicatorStyle indicatorStyle UI_APPEARANCE_SELECTOR;
  139. /** Default is NO */
  140. @property (assign, nonatomic, getter=isShowsVerticalScrollIndicator) BOOL showsVerticalScrollIndicator UI_APPEARANCE_SELECTOR;
  141. /** Default is NO */
  142. @property (assign, nonatomic, getter=isPadShowsActionSheetFromBottom) BOOL padShowsActionSheetFromBottom UI_APPEARANCE_SELECTOR;
  143. /** Default is NO */
  144. @property (assign, nonatomic, getter=isOneRowOneButton) BOOL oneRowOneButton UI_APPEARANCE_SELECTOR;
  145. /** Default is YES */
  146. @property (assign, nonatomic) BOOL shouldDismissAnimated UI_APPEARANCE_SELECTOR;
  147. #pragma marl - Layer properties
  148. /**
  149. Default:
  150. if (iOS < 9.0) then 6.0
  151. else 12.0
  152. */
  153. @property (assign, nonatomic) CGFloat layerCornerRadius UI_APPEARANCE_SELECTOR;
  154. /** Default is nil */
  155. @property (strong, nonatomic, nullable) UIColor *layerBorderColor UI_APPEARANCE_SELECTOR;
  156. /** Default is 0.0 */
  157. @property (assign, nonatomic) CGFloat layerBorderWidth UI_APPEARANCE_SELECTOR;
  158. /** Default is nil */
  159. @property (strong, nonatomic, nullable) UIColor *layerShadowColor UI_APPEARANCE_SELECTOR;
  160. /** Default is 0.0 */
  161. @property (assign, nonatomic) CGFloat layerShadowRadius UI_APPEARANCE_SELECTOR;
  162. /** Default is CGPointZero */
  163. @property (assign, nonatomic) CGPoint layerShadowOffset UI_APPEARANCE_SELECTOR;
  164. #pragma mark - Animation properties
  165. /** Default is 0.5 */
  166. @property (assign, nonatomic) NSTimeInterval animationDuration UI_APPEARANCE_SELECTOR;
  167. /**
  168. Only if (style == LGAlertViewStyleAlert)
  169. Default is 1.2
  170. */
  171. @property (assign, nonatomic) CGFloat initialScale UI_APPEARANCE_SELECTOR;
  172. /**
  173. Only if (style == LGAlertViewStyleAlert)
  174. Default is 0.95
  175. */
  176. @property (assign, nonatomic) CGFloat finalScale UI_APPEARANCE_SELECTOR;
  177. #pragma mark - Title properties
  178. @property (copy, nonatomic, readonly, nullable) NSString *title;
  179. /**
  180. Default:
  181. if (style == LGAlertViewStyleAlert) then UIColor.blackColor
  182. else UIColor.grayColor
  183. */
  184. @property (strong, nonatomic, nullable) UIColor *titleTextColor UI_APPEARANCE_SELECTOR;
  185. /** Default is NSTextAlignmentCenter */
  186. @property (assign, nonatomic) NSTextAlignment titleTextAlignment UI_APPEARANCE_SELECTOR;
  187. /**
  188. Default:
  189. if (style == LGAlertViewStyleAlert) then [UIFont boldSystemFontOfSize:18.0]
  190. else [UIFont boldSystemFontOfSize:14.0]
  191. */
  192. @property (strong, nonatomic, nullable) UIFont *titleFont UI_APPEARANCE_SELECTOR;
  193. #pragma mark - Message properties
  194. @property (copy, nonatomic, readonly, nullable) NSString *message;
  195. /**
  196. Default:
  197. if (style == LGAlertViewStyleAlert) then UIColor.blackColor
  198. else UIColor.grayColor
  199. */
  200. @property (strong, nonatomic, nullable) UIColor *messageTextColor UI_APPEARANCE_SELECTOR;
  201. /** Default is NSTextAlignmentCenter */
  202. @property (assign, nonatomic) NSTextAlignment messageTextAlignment UI_APPEARANCE_SELECTOR;
  203. /** Default is [UIFont systemFontOfSize:14.0] */
  204. @property (strong, nonatomic, nullable) UIFont *messageFont UI_APPEARANCE_SELECTOR;
  205. #pragma mark - Buttons properties
  206. @property (copy, nonatomic, readonly, nullable) NSArray *buttonTitles;
  207. /** Default is YES */
  208. @property (assign, nonatomic, getter=isCancelButtonEnabled) BOOL buttonsEnabled;
  209. @property (copy, nonatomic, nullable) NSArray *buttonsIconImages;
  210. @property (copy, nonatomic, nullable) NSArray *buttonsIconImagesHighlighted;
  211. @property (copy, nonatomic, nullable) NSArray *buttonsIconImagesDisabled;
  212. /** Default is tintColor */
  213. @property (strong, nonatomic, nullable) UIColor *buttonsTitleColor UI_APPEARANCE_SELECTOR;
  214. /** Default is UIColor.whiteColor */
  215. @property (strong, nonatomic, nullable) UIColor *buttonsTitleColorHighlighted UI_APPEARANCE_SELECTOR;
  216. /** Default is UIColor.grayColor */
  217. @property (strong, nonatomic, nullable) UIColor *buttonsTitleColorDisabled UI_APPEARANCE_SELECTOR;
  218. /** Default is NSTextAlignmentCenter */
  219. @property (assign, nonatomic) NSTextAlignment buttonsTextAlignment UI_APPEARANCE_SELECTOR;
  220. /** Default is [UIFont systemFontOfSize:18.0] */
  221. @property (strong, nonatomic, nullable) UIFont *buttonsFont UI_APPEARANCE_SELECTOR;
  222. /** Default is UIColor.clearColor */
  223. @property (strong, nonatomic, nullable) UIColor *buttonsBackgroundColor UI_APPEARANCE_SELECTOR;
  224. /** Default is tintColor */
  225. @property (strong, nonatomic, nullable) UIColor *buttonsBackgroundColorHighlighted UI_APPEARANCE_SELECTOR;
  226. /** Default is UIColor.clearColor */
  227. @property (strong, nonatomic, nullable) UIColor *buttonsBackgroundColorDisabled UI_APPEARANCE_SELECTOR;
  228. /** Default is 1 */
  229. @property (assign, nonatomic) NSUInteger buttonsNumberOfLines UI_APPEARANCE_SELECTOR;
  230. /** Default is NSLineBreakByTruncatingMiddle */
  231. @property (assign, nonatomic) NSLineBreakMode buttonsLineBreakMode UI_APPEARANCE_SELECTOR;
  232. /** Default is 14.0 / 18.0 */
  233. @property (assign, nonatomic) CGFloat buttonsMinimumScaleFactor UI_APPEARANCE_SELECTOR;
  234. /** Default is YES */
  235. @property (assign, nonatomic, getter=isButtonsAdjustsFontSizeToFitWidth) BOOL buttonsAdjustsFontSizeToFitWidth UI_APPEARANCE_SELECTOR;
  236. /** Default is LGAlertViewButtonIconPositionLeft */
  237. @property (assign, nonatomic) LGAlertViewButtonIconPosition buttonsIconPosition UI_APPEARANCE_SELECTOR;
  238. #pragma mark - Cancel button properties
  239. @property (copy, nonatomic, readonly, nullable) NSString *cancelButtonTitle;
  240. /** Default is YES */
  241. @property (assign, nonatomic, getter=isCancelButtonEnabled) BOOL cancelButtonEnabled;
  242. @property (strong, nonatomic, nullable) UIImage *cancelButtonIconImage;
  243. @property (strong, nonatomic, nullable) UIImage *cancelButtonIconImageHighlighted;
  244. @property (strong, nonatomic, nullable) UIImage *cancelButtonIconImageDisabled;
  245. /** Default is tintColor */
  246. @property (strong, nonatomic, nullable) UIColor *cancelButtonTitleColor UI_APPEARANCE_SELECTOR;
  247. /** Default is UIColor.whiteColor */
  248. @property (strong, nonatomic, nullable) UIColor *cancelButtonTitleColorHighlighted UI_APPEARANCE_SELECTOR;
  249. /** Default is UIColor.grayColor */
  250. @property (strong, nonatomic, nullable) UIColor *cancelButtonTitleColorDisabled UI_APPEARANCE_SELECTOR;
  251. /** Default is NSTextAlignmentCenter */
  252. @property (assign, nonatomic) NSTextAlignment cancelButtonTextAlignment UI_APPEARANCE_SELECTOR;
  253. /** Default is [UIFont boldSystemFontOfSize:18.0] */
  254. @property (strong, nonatomic, nullable) UIFont *cancelButtonFont UI_APPEARANCE_SELECTOR;
  255. /** Default is UIColor.clearColor */
  256. @property (strong, nonatomic, nullable) UIColor *cancelButtonBackgroundColor UI_APPEARANCE_SELECTOR;
  257. /** Default is tintColor */
  258. @property (strong, nonatomic, nullable) UIColor *cancelButtonBackgroundColorHighlighted UI_APPEARANCE_SELECTOR;
  259. /** Default is UIColor.clearColor */
  260. @property (strong, nonatomic, nullable) UIColor *cancelButtonBackgroundColorDisabled UI_APPEARANCE_SELECTOR;
  261. /** Default is 1 */
  262. @property (assign, nonatomic) NSUInteger cancelButtonNumberOfLines UI_APPEARANCE_SELECTOR;
  263. /** Default is NSLineBreakByTruncatingMiddle */
  264. @property (assign, nonatomic) NSLineBreakMode cancelButtonLineBreakMode UI_APPEARANCE_SELECTOR;
  265. /** Default is 14.0 / 18.0 */
  266. @property (assign, nonatomic) CGFloat cancelButtonMinimumScaleFactor UI_APPEARANCE_SELECTOR;
  267. /** Default is YES */
  268. @property (assign, nonatomic, getter=isCancelButtonAdjustsFontSizeToFitWidth) BOOL cancelButtonAdjustsFontSizeToFitWidth UI_APPEARANCE_SELECTOR;
  269. /** Default is LGAlertViewButtonIconPositionLeft */
  270. @property (assign, nonatomic) LGAlertViewButtonIconPosition cancelButtonIconPosition UI_APPEARANCE_SELECTOR;
  271. #pragma mark - Destructive button properties
  272. @property (copy, nonatomic, readonly, nullable) NSString *destructiveButtonTitle;
  273. /** Default is YES */
  274. @property (assign, nonatomic, getter=isDestructiveButtonEnabled) BOOL destructiveButtonEnabled;
  275. @property (strong, nonatomic, nullable) UIImage *destructiveButtonIconImage;
  276. @property (strong, nonatomic, nullable) UIImage *destructiveButtonIconImageHighlighted;
  277. @property (strong, nonatomic, nullable) UIImage *destructiveButtonIconImageDisabled;
  278. /** Default is UIColor.redColor */
  279. @property (strong, nonatomic, nullable) UIColor *destructiveButtonTitleColor UI_APPEARANCE_SELECTOR;
  280. /** Default is UIColor.whiteColor */
  281. @property (strong, nonatomic, nullable) UIColor *destructiveButtonTitleColorHighlighted UI_APPEARANCE_SELECTOR;
  282. /** Default is UIColor.grayColor */
  283. @property (strong, nonatomic, nullable) UIColor *destructiveButtonTitleColorDisabled UI_APPEARANCE_SELECTOR;
  284. /** Default is NSTextAlignmentCenter */
  285. @property (assign, nonatomic) NSTextAlignment destructiveButtonTextAlignment UI_APPEARANCE_SELECTOR;
  286. /** Default is [UIFont systemFontOfSize:18.0] */
  287. @property (strong, nonatomic, nullable) UIFont *destructiveButtonFont UI_APPEARANCE_SELECTOR;
  288. /** Default is UIColor.clearColor */
  289. @property (strong, nonatomic, nullable) UIColor *destructiveButtonBackgroundColor UI_APPEARANCE_SELECTOR;
  290. /** Default is UIColor.redColor */
  291. @property (strong, nonatomic, nullable) UIColor *destructiveButtonBackgroundColorHighlighted UI_APPEARANCE_SELECTOR;
  292. /** Default is UIColor.clearColor */
  293. @property (strong, nonatomic, nullable) UIColor *destructiveButtonBackgroundColorDisabled UI_APPEARANCE_SELECTOR;
  294. /** Default is 1 */
  295. @property (assign, nonatomic) NSUInteger destructiveButtonNumberOfLines UI_APPEARANCE_SELECTOR;
  296. /** Default is NSLineBreakByTruncatingMiddle */
  297. @property (assign, nonatomic) NSLineBreakMode destructiveButtonLineBreakMode UI_APPEARANCE_SELECTOR;
  298. /** Default is 14.0 / 18.0 */
  299. @property (assign, nonatomic) CGFloat destructiveButtonMinimumScaleFactor UI_APPEARANCE_SELECTOR;
  300. /** Default is YES */
  301. @property (assign, nonatomic, getter=isDestructiveButtonAdjustsFontSizeToFitWidth) BOOL destructiveButtonAdjustsFontSizeToFitWidth UI_APPEARANCE_SELECTOR;
  302. /** Default is LGAlertViewButtonIconPositionLeft */
  303. @property (assign, nonatomic) LGAlertViewButtonIconPosition destructiveButtonIconPosition UI_APPEARANCE_SELECTOR;
  304. #pragma mark - Activity indicator properties
  305. /** Default is UIActivityIndicatorViewStyleWhiteLarge */
  306. @property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle UI_APPEARANCE_SELECTOR;
  307. /** Default is tintColor */
  308. @property (strong, nonatomic, nullable) UIColor *activityIndicatorViewColor UI_APPEARANCE_SELECTOR;
  309. #pragma mark - Progress view properties
  310. @property (assign, nonatomic) float progress;
  311. /** Default is tintColor */
  312. @property (strong, nonatomic, nullable) UIColor *progressViewProgressTintColor UI_APPEARANCE_SELECTOR;
  313. /** Default is [UIColor colorWithWhite:0.8 alpha:1.0] */
  314. @property (strong, nonatomic, nullable) UIColor *progressViewTrackTintColor UI_APPEARANCE_SELECTOR;
  315. /** Default is nil */
  316. @property (strong, nonatomic, nullable) UIImage *progressViewProgressImage UI_APPEARANCE_SELECTOR;
  317. /** Default is nil */
  318. @property (strong, nonatomic, nullable) UIImage *progressViewTrackImage UI_APPEARANCE_SELECTOR;
  319. #pragma mark - Progress label properties
  320. @property (strong, nonatomic, nullable) NSString *progressLabelText;
  321. /** Default is UIColor.blackColor */
  322. @property (strong, nonatomic, nullable) UIColor *progressLabelTextColor UI_APPEARANCE_SELECTOR;
  323. /** Defailt is NSTextAlignmentCenter */
  324. @property (assign, nonatomic) NSTextAlignment progressLabelTextAlignment UI_APPEARANCE_SELECTOR;
  325. /** Default is [UIFont systemFontOfSize:14.0] */
  326. @property (strong, nonatomic, nullable) UIFont *progressLabelFont UI_APPEARANCE_SELECTOR;
  327. /** Default is 1 */
  328. @property (assign, nonatomic) NSUInteger progressLabelNumberOfLines UI_APPEARANCE_SELECTOR;
  329. /** Default is NSLineBreakByTruncatingTail */
  330. @property (assign, nonatomic) NSLineBreakMode progressLabelLineBreakMode UI_APPEARANCE_SELECTOR;
  331. #pragma mark - Text fields properties
  332. /** Default is [UIColor colorWithWhite:0.97 alpha:1.0] */
  333. @property (strong, nonatomic, nullable) UIColor *textFieldsBackgroundColor UI_APPEARANCE_SELECTOR;
  334. /** Default is UIColor.blackColor */
  335. @property (strong, nonatomic, nullable) UIColor *textFieldsTextColor UI_APPEARANCE_SELECTOR;
  336. /** Default is [UIFont systemFontOfSize:16.0] */
  337. @property (strong, nonatomic, nullable) UIFont *textFieldsFont UI_APPEARANCE_SELECTOR;
  338. /** Default is NSTextAlignmentLeft */
  339. @property (assign, nonatomic) NSTextAlignment textFieldsTextAlignment UI_APPEARANCE_SELECTOR;
  340. /** Default is NO */
  341. @property (assign, nonatomic) BOOL textFieldsClearsOnBeginEditing UI_APPEARANCE_SELECTOR;
  342. /** Default is NO */
  343. @property (assign, nonatomic) BOOL textFieldsAdjustsFontSizeToFitWidth UI_APPEARANCE_SELECTOR;
  344. /** Default is 12.0 */
  345. @property (assign, nonatomic) CGFloat textFieldsMinimumFontSize UI_APPEARANCE_SELECTOR;
  346. /** Default is UITextFieldViewModeAlways */
  347. @property (assign, nonatomic) UITextFieldViewMode textFieldsClearButtonMode UI_APPEARANCE_SELECTOR;
  348. #pragma mark - Callbacks
  349. /** To avoid retain cycle, do not forget about weak reference to self */
  350. @property (copy, nonatomic) LGAlertViewHandler willShowHandler;
  351. /** To avoid retain cycle, do not forget about weak reference to self */
  352. @property (copy, nonatomic) LGAlertViewHandler didShowHandler;
  353. /** To avoid retain cycle, do not forget about weak reference to self */
  354. @property (copy, nonatomic) LGAlertViewHandler willDismissHandler;
  355. /** To avoid retain cycle, do not forget about weak reference to self */
  356. @property (copy, nonatomic) LGAlertViewHandler didDismissHandler;
  357. /** To avoid retain cycle, do not forget about weak reference to self */
  358. @property (copy, nonatomic) LGAlertViewActionHandler actionHandler;
  359. /** To avoid retain cycle, do not forget about weak reference to self */
  360. @property (copy, nonatomic) LGAlertViewHandler cancelHandler;
  361. /** To avoid retain cycle, do not forget about weak reference to self */
  362. @property (copy, nonatomic) LGAlertViewHandler destructiveHandler;
  363. /** To avoid retain cycle, do not forget about weak reference to self */
  364. @property (copy, nonatomic) LGAlertViewActionHandler didDismissAfterActionHandler;
  365. /** To avoid retain cycle, do not forget about weak reference to self */
  366. @property (copy, nonatomic) LGAlertViewHandler didDismissAfterCancelHandler;
  367. /** To avoid retain cycle, do not forget about weak reference to self */
  368. @property (copy, nonatomic) LGAlertViewHandler didDismissAfterDestructiveHandler;
  369. /**
  370. You can use this block to add some custom animations
  371. To avoid retain cycle, do not forget about weak reference to self
  372. */
  373. @property (copy, nonatomic, nullable) LGAlertViewAnimationsBlock showAnimationsBlock;
  374. /**
  375. You can use this block to add some custom animations
  376. To avoid retain cycle, do not forget about weak reference to self
  377. */
  378. @property (copy, nonatomic, nullable) LGAlertViewAnimationsBlock dismissAnimationsBlock;
  379. #pragma mark - Delegate
  380. @property (weak, nonatomic, nullable) id <LGAlertViewDelegate> delegate;
  381. #pragma mark - Initialization
  382. - (nonnull instancetype)initWithTitle:(nullable NSString *)title
  383. message:(nullable NSString *)message
  384. style:(LGAlertViewStyle)style
  385. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  386. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  387. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  388. - (nonnull instancetype)initWithViewAndTitle:(nullable NSString *)title
  389. message:(nullable NSString *)message
  390. style:(LGAlertViewStyle)style
  391. view:(nullable UIView *)view
  392. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  393. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  394. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  395. - (nonnull instancetype)initWithActivityIndicatorAndTitle:(nullable NSString *)title
  396. message:(nullable NSString *)message
  397. style:(LGAlertViewStyle)style
  398. progressLabelText:(nullable NSString *)progressLabelText
  399. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  400. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  401. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  402. - (nonnull instancetype)initWithProgressViewAndTitle:(nullable NSString *)title
  403. message:(nullable NSString *)message
  404. style:(LGAlertViewStyle)style
  405. progress:(float)progress
  406. progressLabelText:(nullable NSString *)progressLabelText
  407. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  408. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  409. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  410. /** To avoid retain cycle, do not forget about weak reference to self for textFieldsSetupHandler block */
  411. - (nonnull instancetype)initWithTextFieldsAndTitle:(nullable NSString *)title
  412. message:(nullable NSString *)message
  413. numberOfTextFields:(NSUInteger)numberOfTextFields
  414. textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler
  415. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  416. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  417. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  418. + (nonnull instancetype)alertViewWithTitle:(nullable NSString *)title
  419. message:(nullable NSString *)message
  420. style:(LGAlertViewStyle)style
  421. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  422. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  423. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  424. + (nonnull instancetype)alertViewWithViewAndTitle:(nullable NSString *)title
  425. message:(nullable NSString *)message
  426. style:(LGAlertViewStyle)style
  427. view:(nullable UIView *)view
  428. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  429. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  430. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  431. + (nonnull instancetype)alertViewWithActivityIndicatorAndTitle:(nullable NSString *)title
  432. message:(nullable NSString *)message
  433. style:(LGAlertViewStyle)style
  434. progressLabelText:(nullable NSString *)progressLabelText
  435. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  436. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  437. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  438. + (nonnull instancetype)alertViewWithProgressViewAndTitle:(nullable NSString *)title
  439. message:(nullable NSString *)message
  440. style:(LGAlertViewStyle)style
  441. progress:(float)progress
  442. progressLabelText:(nullable NSString *)progressLabelText
  443. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  444. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  445. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  446. + (nonnull instancetype)alertViewWithTextFieldsAndTitle:(nullable NSString *)title
  447. message:(nullable NSString *)message
  448. numberOfTextFields:(NSUInteger)numberOfTextFields
  449. textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler
  450. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  451. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  452. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
  453. #pragma mark -
  454. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  455. - (nonnull instancetype)initWithTitle:(nullable NSString *)title
  456. message:(nullable NSString *)message
  457. style:(LGAlertViewStyle)style
  458. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  459. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  460. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  461. actionHandler:(LGAlertViewActionHandler)actionHandler
  462. cancelHandler:(LGAlertViewHandler)cancelHandler
  463. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  464. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  465. - (nonnull instancetype)initWithViewAndTitle:(nullable NSString *)title
  466. message:(nullable NSString *)message
  467. style:(LGAlertViewStyle)style
  468. view:(nullable UIView *)view
  469. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  470. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  471. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  472. actionHandler:(LGAlertViewActionHandler)actionHandler
  473. cancelHandler:(LGAlertViewHandler)cancelHandler
  474. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  475. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  476. - (nonnull instancetype)initWithActivityIndicatorAndTitle:(nullable NSString *)title
  477. message:(nullable NSString *)message
  478. style:(LGAlertViewStyle)style
  479. progressLabelText:(nullable NSString *)progressLabelText
  480. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  481. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  482. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  483. actionHandler:(LGAlertViewActionHandler)actionHandler
  484. cancelHandler:(LGAlertViewHandler)cancelHandler
  485. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  486. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  487. - (nonnull instancetype)initWithProgressViewAndTitle:(nullable NSString *)title
  488. message:(nullable NSString *)message
  489. style:(LGAlertViewStyle)style
  490. progress:(float)progress
  491. progressLabelText:(nullable NSString *)progressLabelText
  492. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  493. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  494. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  495. actionHandler:(LGAlertViewActionHandler)actionHandler
  496. cancelHandler:(LGAlertViewHandler)cancelHandler
  497. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  498. /** To avoid retain cycle, do not forget about weak reference to self for textFieldsSetupHandler, actionHandler, cancelHandler and destructiveHandler blocks */
  499. - (nonnull instancetype)initWithTextFieldsAndTitle:(nullable NSString *)title
  500. message:(nullable NSString *)message
  501. numberOfTextFields:(NSUInteger)numberOfTextFields
  502. textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler
  503. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  504. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  505. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  506. actionHandler:(LGAlertViewActionHandler)actionHandler
  507. cancelHandler:(LGAlertViewHandler)cancelHandler
  508. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  509. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  510. + (nonnull instancetype)alertViewWithTitle:(nullable NSString *)title
  511. message:(nullable NSString *)message
  512. style:(LGAlertViewStyle)style
  513. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  514. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  515. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  516. actionHandler:(LGAlertViewActionHandler)actionHandler
  517. cancelHandler:(LGAlertViewHandler)cancelHandler
  518. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  519. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  520. + (nonnull instancetype)alertViewWithViewAndTitle:(nullable NSString *)title
  521. message:(nullable NSString *)message
  522. style:(LGAlertViewStyle)style
  523. view:(nullable UIView *)view
  524. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  525. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  526. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  527. actionHandler:(LGAlertViewActionHandler)actionHandler
  528. cancelHandler:(LGAlertViewHandler)cancelHandler
  529. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  530. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  531. + (nonnull instancetype)alertViewWithActivityIndicatorAndTitle:(nullable NSString *)title
  532. message:(nullable NSString *)message
  533. style:(LGAlertViewStyle)style
  534. progressLabelText:(nullable NSString *)progressLabelText
  535. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  536. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  537. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  538. actionHandler:(LGAlertViewActionHandler)actionHandler
  539. cancelHandler:(LGAlertViewHandler)cancelHandler
  540. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  541. /** To avoid retain cycle, do not forget about weak reference to self for actionHandler, cancelHandler and destructiveHandler blocks */
  542. + (nonnull instancetype)alertViewWithProgressViewAndTitle:(nullable NSString *)title
  543. message:(nullable NSString *)message
  544. style:(LGAlertViewStyle)style
  545. progress:(float)progress
  546. progressLabelText:(nullable NSString *)progressLabelText
  547. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  548. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  549. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  550. actionHandler:(LGAlertViewActionHandler)actionHandler
  551. cancelHandler:(LGAlertViewHandler)cancelHandler
  552. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  553. /** To avoid retain cycle, do not forget about weak reference to self for textFieldsSetupHandler, actionHandler, cancelHandler and destructiveHandler blocks */
  554. + (nonnull instancetype)alertViewWithTextFieldsAndTitle:(nullable NSString *)title
  555. message:(nullable NSString *)message
  556. numberOfTextFields:(NSUInteger)numberOfTextFields
  557. textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler
  558. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  559. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  560. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  561. actionHandler:(LGAlertViewActionHandler)actionHandler
  562. cancelHandler:(LGAlertViewHandler)cancelHandler
  563. destructiveHandler:(LGAlertViewHandler)destructiveHandler;
  564. #pragma mark -
  565. - (nonnull instancetype)initWithTitle:(nullable NSString *)title
  566. message:(nullable NSString *)message
  567. style:(LGAlertViewStyle)style
  568. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  569. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  570. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  571. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  572. - (nonnull instancetype)initWithViewAndTitle:(nullable NSString *)title
  573. message:(nullable NSString *)message
  574. style:(LGAlertViewStyle)style
  575. view:(nullable UIView *)view
  576. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  577. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  578. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  579. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  580. - (nonnull instancetype)initWithActivityIndicatorAndTitle:(nullable NSString *)title
  581. message:(nullable NSString *)message
  582. style:(LGAlertViewStyle)style
  583. progressLabelText:(nullable NSString *)progressLabelText
  584. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  585. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  586. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  587. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  588. - (nonnull instancetype)initWithProgressViewAndTitle:(nullable NSString *)title
  589. message:(nullable NSString *)message
  590. style:(LGAlertViewStyle)style
  591. progress:(float)progress
  592. progressLabelText:(nullable NSString *)progressLabelText
  593. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  594. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  595. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  596. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  597. /** To avoid retain cycle, do not forget about weak reference to self for textFieldsSetupHandler block */
  598. - (nonnull instancetype)initWithTextFieldsAndTitle:(nullable NSString *)title
  599. message:(nullable NSString *)message
  600. numberOfTextFields:(NSUInteger)numberOfTextFields
  601. textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler
  602. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  603. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  604. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  605. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  606. + (nonnull instancetype)alertViewWithTitle:(nullable NSString *)title
  607. message:(nullable NSString *)message
  608. style:(LGAlertViewStyle)style
  609. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  610. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  611. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  612. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  613. + (nonnull instancetype)alertViewWithViewAndTitle:(nullable NSString *)title
  614. message:(nullable NSString *)message
  615. style:(LGAlertViewStyle)style
  616. view:(nullable UIView *)view
  617. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  618. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  619. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  620. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  621. + (nonnull instancetype)alertViewWithActivityIndicatorAndTitle:(nullable NSString *)title
  622. message:(nullable NSString *)message
  623. style:(LGAlertViewStyle)style
  624. progressLabelText:(nullable NSString *)progressLabelText
  625. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  626. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  627. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  628. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  629. + (nonnull instancetype)alertViewWithProgressViewAndTitle:(nullable NSString *)title
  630. message:(nullable NSString *)message
  631. style:(LGAlertViewStyle)style
  632. progress:(float)progress
  633. progressLabelText:(nullable NSString *)progressLabelText
  634. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  635. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  636. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  637. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  638. /** To avoid retain cycle, do not forget about weak reference to self for textFieldsSetupHandler block */
  639. + (nonnull instancetype)alertViewWithTextFieldsAndTitle:(nullable NSString *)title
  640. message:(nullable NSString *)message
  641. numberOfTextFields:(NSUInteger)numberOfTextFields
  642. textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler
  643. buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
  644. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  645. destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle
  646. delegate:(nullable id<LGAlertViewDelegate>)delegate;
  647. #pragma mark -
  648. - (void)showAnimated:(BOOL)animated completionHandler:(LGAlertViewCompletionHandler)completionHandler;
  649. - (void)showAnimated;
  650. - (void)show;
  651. - (void)dismissAnimated:(BOOL)animated completionHandler:(LGAlertViewCompletionHandler)completionHandler;
  652. - (void)dismissAnimated;
  653. - (void)dismiss;
  654. - (void)transitionToAlertView:(nonnull LGAlertView *)alertView completionHandler:(LGAlertViewCompletionHandler)completionHandler;
  655. - (void)transitionToAlertView:(nonnull LGAlertView *)alertView;
  656. - (void)setProgress:(float)progress progressLabelText:(nullable NSString *)progressLabelText;
  657. - (void)setButtonPropertiesAtIndex:(NSUInteger)index handler:(void(^ _Nonnull)(LGAlertViewButtonProperties * _Nonnull properties))handler;
  658. - (void)setButtonEnabled:(BOOL)enabled atIndex:(NSUInteger)index;
  659. - (BOOL)isButtonEnabledAtIndex:(NSUInteger)index;
  660. - (void)layoutValidateWithSize:(CGSize)size;
  661. - (void)forceCancel;
  662. - (void)forceDestructive;
  663. - (void)forceActionAtIndex:(NSUInteger)index;
  664. #pragma mark - Unavailable
  665. - (nonnull instancetype)init __attribute__((unavailable("use \"- initWith...\" instead")));
  666. + (nonnull instancetype)new __attribute__((unavailable("use \"+ alertViewWith...\" instead")));
  667. @end
  668. #pragma mark - Delegate
  669. @protocol LGAlertViewDelegate <NSObject>
  670. @optional
  671. - (void)alertViewWillShow:(nonnull LGAlertView *)alertView;
  672. - (void)alertViewDidShow:(nonnull LGAlertView *)alertView;
  673. - (void)alertViewWillDismiss:(nonnull LGAlertView *)alertView;
  674. - (void)alertViewDidDismiss:(nonnull LGAlertView *)alertView;
  675. - (void)alertView:(nonnull LGAlertView *)alertView clickedButtonAtIndex:(NSUInteger)index title:(nullable NSString *)title;
  676. - (void)alertViewCancelled:(nonnull LGAlertView *)alertView;
  677. - (void)alertViewDestructed:(nonnull LGAlertView *)alertView;
  678. - (void)alertView:(nonnull LGAlertView *)alertView didDismissAfterClickedButtonAtIndex:(NSUInteger)index title:(nullable NSString *)title;
  679. - (void)alertViewDidDismissAfterCancelled:(nonnull LGAlertView *)alertView;
  680. - (void)alertViewDidDismissAfterDestructed:(nonnull LGAlertView *)alertView;
  681. /** You can use this method to add some custom animations */
  682. - (void)showAnimationsForAlertView:(nonnull LGAlertView *)alertView duration:(NSTimeInterval)duration;
  683. /** You can use this method to add some custom animations */
  684. - (void)dismissAnimationsForAlertView:(nonnull LGAlertView *)alertView duration:(NSTimeInterval)duration;
  685. // DEPRECATED
  686. - (void)alertView:(nonnull LGAlertView *)alertView buttonPressedWithTitle:(nullable NSString *)title index:(NSUInteger)index
  687. DEPRECATED_MSG_ATTRIBUTE("use alertView:clickedButtonAtIndex:title: instead");
  688. - (void)alertViewDestructiveButtonPressed:(nonnull LGAlertView *)alertView
  689. DEPRECATED_MSG_ATTRIBUTE("use alertViewDidDismissAfterDestructed: instead");
  690. @end
  691. #pragma mark - Deprecated
  692. @interface LGAlertView (Deprecated)
  693. @property (assign, nonatomic) CGFloat layerShadowOpacity
  694. DEPRECATED_MSG_ATTRIBUTE("use layerShadowColor alpha component instead");
  695. - (void)setButtonAtIndex:(NSUInteger)index enabled:(BOOL)enabled
  696. DEPRECATED_MSG_ATTRIBUTE("use setButtonEnabled:atIndex: instead");
  697. @end