SCLAlertView.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. //
  2. // SCLAlertView.h
  3. // SCLAlertView
  4. //
  5. // Created by Diogo Autilio on 9/26/14.
  6. // Copyright (c) 2014-2017 AnyKey Entertainment. All rights reserved.
  7. //
  8. #if defined(__has_feature) && __has_feature(modules)
  9. @import UIKit;
  10. #else
  11. #import <UIKit/UIKit.h>
  12. #endif
  13. #import "SCLButton.h"
  14. #import "SCLTextView.h"
  15. #import "SCLSwitchView.h"
  16. typedef NSAttributedString* (^SCLAttributedFormatBlock)(NSString *value);
  17. typedef void (^SCLDismissBlock)(void);
  18. typedef void (^SCLDismissAnimationCompletionBlock)(void);
  19. typedef void (^SCLShowAnimationCompletionBlock)(void);
  20. typedef void (^SCLForceHideBlock)(void);
  21. @interface SCLAlertView : UIViewController
  22. /** Alert Styles
  23. *
  24. * Set SCLAlertView Style
  25. */
  26. typedef NS_ENUM(NSInteger, SCLAlertViewStyle)
  27. {
  28. SCLAlertViewStyleSuccess,
  29. SCLAlertViewStyleError,
  30. SCLAlertViewStyleNotice,
  31. SCLAlertViewStyleWarning,
  32. SCLAlertViewStyleInfo,
  33. SCLAlertViewStyleEdit,
  34. SCLAlertViewStyleWaiting,
  35. SCLAlertViewStyleQuestion,
  36. SCLAlertViewStyleCustom
  37. };
  38. /** Alert hide animation styles
  39. *
  40. * Set SCLAlertView hide animation type.
  41. */
  42. typedef NS_ENUM(NSInteger, SCLAlertViewHideAnimation)
  43. {
  44. SCLAlertViewHideAnimationFadeOut,
  45. SCLAlertViewHideAnimationSlideOutToBottom,
  46. SCLAlertViewHideAnimationSlideOutToTop,
  47. SCLAlertViewHideAnimationSlideOutToLeft,
  48. SCLAlertViewHideAnimationSlideOutToRight,
  49. SCLAlertViewHideAnimationSlideOutToCenter,
  50. SCLAlertViewHideAnimationSlideOutFromCenter,
  51. SCLAlertViewHideAnimationSimplyDisappear
  52. };
  53. /** Alert show animation styles
  54. *
  55. * Set SCLAlertView show animation type.
  56. */
  57. typedef NS_ENUM(NSInteger, SCLAlertViewShowAnimation)
  58. {
  59. SCLAlertViewShowAnimationFadeIn,
  60. SCLAlertViewShowAnimationSlideInFromBottom,
  61. SCLAlertViewShowAnimationSlideInFromTop,
  62. SCLAlertViewShowAnimationSlideInFromLeft,
  63. SCLAlertViewShowAnimationSlideInFromRight,
  64. SCLAlertViewShowAnimationSlideInFromCenter,
  65. SCLAlertViewShowAnimationSlideInToCenter,
  66. SCLAlertViewShowAnimationSimplyAppear
  67. };
  68. /** Alert background styles
  69. *
  70. * Set SCLAlertView background type.
  71. */
  72. typedef NS_ENUM(NSInteger, SCLAlertViewBackground)
  73. {
  74. SCLAlertViewBackgroundShadow,
  75. SCLAlertViewBackgroundBlur,
  76. SCLAlertViewBackgroundTransparent
  77. };
  78. /** Content view corner radius
  79. *
  80. * A float value that replaces the standard content viuew corner radius.
  81. */
  82. @property CGFloat cornerRadius;
  83. /** Tint top circle
  84. *
  85. * A boolean value that determines whether to tint the SCLAlertView top circle.
  86. * (Default: YES)
  87. */
  88. @property (assign, nonatomic) BOOL tintTopCircle;
  89. /** Use larger icon
  90. *
  91. * A boolean value that determines whether to make the SCLAlertView top circle icon larger.
  92. * (Default: NO)
  93. */
  94. @property (assign, nonatomic) BOOL useLargerIcon;
  95. /** Title Label
  96. *
  97. * The text displayed as title.
  98. */
  99. @property (strong, nonatomic) UILabel *labelTitle;
  100. /** Text view with the body message
  101. *
  102. * Holds the textview.
  103. */
  104. @property (strong, nonatomic) UITextView *viewText;
  105. /** Activity Indicator
  106. *
  107. * Holds the activityIndicator.
  108. */
  109. @property (strong, nonatomic) UIActivityIndicatorView *activityIndicatorView;
  110. /** Dismiss on tap outside
  111. *
  112. * A boolean value that determines whether to dismiss when tapping outside the SCLAlertView.
  113. * (Default: NO)
  114. */
  115. @property (assign, nonatomic) BOOL shouldDismissOnTapOutside;
  116. /** Sound URL
  117. *
  118. * Holds the sound NSURL path.
  119. */
  120. @property (strong, nonatomic) NSURL *soundURL;
  121. /** Set text attributed format block
  122. *
  123. * Holds the attributed string.
  124. */
  125. @property (copy, nonatomic) SCLAttributedFormatBlock attributedFormatBlock;
  126. /** Set Complete button format block.
  127. *
  128. * Holds the button format block.
  129. * Support keys : backgroundColor, borderWidth, borderColor, textColor
  130. */
  131. @property (copy, nonatomic) CompleteButtonFormatBlock completeButtonFormatBlock;
  132. /** Set button format block.
  133. *
  134. * Holds the button format block.
  135. * Support keys : backgroundColor, borderWidth, borderColor, textColor
  136. */
  137. @property (copy, nonatomic) ButtonFormatBlock buttonFormatBlock;
  138. /** Set force hide block.
  139. *
  140. * When set force hideview method invocation.
  141. */
  142. @property (copy, nonatomic) SCLForceHideBlock forceHideBlock;
  143. /** Hide animation type
  144. *
  145. * Holds the hide animation type.
  146. * (Default: FadeOut)
  147. */
  148. @property (nonatomic) SCLAlertViewHideAnimation hideAnimationType;
  149. /** Show animation type
  150. *
  151. * Holds the show animation type.
  152. * (Default: SlideInFromTop)
  153. */
  154. @property (nonatomic) SCLAlertViewShowAnimation showAnimationType;
  155. /** Set SCLAlertView background type.
  156. *
  157. * SCLAlertView background type.
  158. * (Default: Shadow)
  159. */
  160. @property (nonatomic) SCLAlertViewBackground backgroundType;
  161. /** Set custom color to SCLAlertView.
  162. *
  163. * SCLAlertView custom color.
  164. * (Buttons, top circle and borders)
  165. */
  166. @property (strong, nonatomic) UIColor *customViewColor;
  167. /** Set custom color to SCLAlertView background.
  168. *
  169. * SCLAlertView background custom color.
  170. */
  171. @property (strong, nonatomic) UIColor *backgroundViewColor;
  172. /** Set custom tint color for icon image.
  173. *
  174. * SCLAlertView icon tint color
  175. */
  176. @property (strong, nonatomic) UIColor *iconTintColor;
  177. /** Set custom circle icon height.
  178. *
  179. * Circle icon height
  180. */
  181. @property (nonatomic) CGFloat circleIconHeight;
  182. /** Set SCLAlertView extension bounds.
  183. *
  184. * Set new bounds (EXTENSION ONLY)
  185. */
  186. @property (nonatomic) CGRect extensionBounds;
  187. /** Set status bar hidden.
  188. *
  189. * Status bar hidden
  190. */
  191. @property (nonatomic) BOOL statusBarHidden;
  192. /** Set status bar style.
  193. *
  194. * Status bar style
  195. */
  196. @property (nonatomic) UIStatusBarStyle statusBarStyle;
  197. /** Set horizontal alignment for buttons
  198. *
  199. * Horizontal aligment instead of vertically if YES
  200. */
  201. @property (nonatomic) BOOL horizontalButtons;
  202. /** Initialize SCLAlertView using specific width.
  203. *
  204. * Init instance
  205. */
  206. - (instancetype)initWithWidth:(CGFloat)width;
  207. /** Initialize SCLAlertView using a new window.
  208. *
  209. * Init with new window
  210. */
  211. - (instancetype)initWithNewWindow;
  212. /** Initialize SCLAlertView using a new window.
  213. *
  214. * Init with new window with custom width
  215. */
  216. - (instancetype)initWithNewWindowWidth:(CGFloat)windowWidth;
  217. /** Warns that alerts is gone
  218. *
  219. * Warns that alerts is gone using block
  220. */
  221. - (void)alertIsDismissed:(SCLDismissBlock)dismissBlock;
  222. /** Warns that alerts dismiss animation is completed
  223. *
  224. * Warns that alerts dismiss animation is completed
  225. */
  226. - (void)alertDismissAnimationIsCompleted:(SCLDismissAnimationCompletionBlock)dismissAnimationCompletionBlock;
  227. /** Warns that alerts show animation is completed
  228. *
  229. * Warns that alerts show animation is completed
  230. */
  231. - (void)alertShowAnimationIsCompleted:(SCLShowAnimationCompletionBlock)showAnimationCompletionBlock;
  232. /** Hide SCLAlertView
  233. *
  234. * Hide SCLAlertView using animation and removing from super view.
  235. */
  236. - (void)hideView;
  237. /** SCLAlertView visibility
  238. *
  239. * Returns if the alert is visible or not.
  240. */
  241. - (BOOL)isVisible;
  242. /** Remove Top Circle
  243. *
  244. * Remove top circle from SCLAlertView.
  245. */
  246. - (void)removeTopCircle;
  247. /** Add a custom UIView
  248. *
  249. * @param customView UIView object to be added above the first SCLButton.
  250. */
  251. - (UIView *)addCustomView:(UIView *)customView;
  252. /** Add Text Field
  253. *
  254. * @param title The text displayed on the textfield.
  255. */
  256. - (SCLTextView *)addTextField:(NSString *)title setDefaultText:(NSString *)defaultText;
  257. /** Add a custom Text Field
  258. *
  259. * @param textField The custom textfield provided by the programmer.
  260. */
  261. - (void)addCustomTextField:(UITextField *)textField;
  262. /** Add a switch view
  263. *
  264. * @param label The label displayed for the switch.
  265. */
  266. - (SCLSwitchView *)addSwitchViewWithLabel:(NSString *)label;
  267. /** Add Timer Display
  268. *
  269. * @param buttonIndex The index of the button to add the timer display to.
  270. * @param reverse Convert timer to countdown.
  271. */
  272. - (void)addTimerToButtonIndex:(NSInteger)buttonIndex reverse:(BOOL)reverse;
  273. /** Set Title font family and size
  274. *
  275. * @param titleFontFamily The family name used to displayed the title.
  276. * @param size Font size.
  277. */
  278. - (void)setTitleFontFamily:(NSString *)titleFontFamily withSize:(CGFloat)size;
  279. /** Set Text field font family and size
  280. *
  281. * @param bodyTextFontFamily The family name used to displayed the text field.
  282. * @param size Font size.
  283. */
  284. - (void)setBodyTextFontFamily:(NSString *)bodyTextFontFamily withSize:(CGFloat)size;
  285. /** Set Buttons font family and size
  286. *
  287. * @param buttonsFontFamily The family name used to displayed the buttons.
  288. * @param size Font size.
  289. */
  290. - (void)setButtonsTextFontFamily:(NSString *)buttonsFontFamily withSize:(CGFloat)size;
  291. /** Add a Button with a title and a block to handle when the button is pressed.
  292. *
  293. * @param title The text displayed on the button.
  294. * @param action A block of code to be executed when the button is pressed.
  295. */
  296. - (SCLButton *)addButton:(NSString *)title actionBlock:(SCLActionBlock)action;
  297. /** Add a Button with a title, a block to handle validation, and a block to handle when the button is pressed and validation succeeds.
  298. *
  299. * @param title The text displayed on the button.
  300. * @param validationBlock A block of code that will allow you to validate fields or do any other logic you may want to do to determine if the alert should be dismissed or not. Inside of this block, return a BOOL indicating whether or not the action block should be called and the alert dismissed.
  301. * @param action A block of code to be executed when the button is pressed and validation passes.
  302. */
  303. - (SCLButton *)addButton:(NSString *)title validationBlock:(SCLValidationBlock)validationBlock actionBlock:(SCLActionBlock)action;
  304. /** Add a Button with a title, a target and a selector to handle when the button is pressed.
  305. *
  306. * @param title The text displayed on the button.
  307. * @param target Add target for particular event.
  308. * @param selector A method to be executed when the button is pressed.
  309. */
  310. - (SCLButton *)addButton:(NSString *)title target:(id)target selector:(SEL)selector;
  311. /** Show Success SCLAlertView
  312. *
  313. * @param vc The view controller the alert view will be displayed in.
  314. * @param title The text displayed on the button.
  315. * @param subTitle The subtitle text of the alert view.
  316. * @param closeButtonTitle The text for the close button.
  317. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  318. */
  319. - (void)showSuccess:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  320. - (void)showSuccess:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  321. /** Show Error SCLAlertView
  322. *
  323. * @param vc The view controller the alert view will be displayed in.
  324. * @param title The text displayed on the button.
  325. * @param subTitle The subtitle text of the alert view.
  326. * @param closeButtonTitle The text for the close button.
  327. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  328. */
  329. - (void)showError:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  330. - (void)showError:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  331. /** Show Notice SCLAlertView
  332. *
  333. * @param vc The view controller the alert view will be displayed in.
  334. * @param title The text displayed on the button.
  335. * @param subTitle The subtitle text of the alert view.
  336. * @param closeButtonTitle The text for the close button.
  337. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  338. */
  339. - (void)showNotice:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  340. - (void)showNotice:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  341. /** Show Warning SCLAlertView
  342. *
  343. * @param vc The view controller the alert view will be displayed in.
  344. * @param title The text displayed on the button.
  345. * @param subTitle The subtitle text of the alert view.
  346. * @param closeButtonTitle The text for the close button.
  347. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  348. */
  349. - (void)showWarning:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  350. - (void)showWarning:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  351. /** Show Info SCLAlertView
  352. *
  353. * @param vc The view controller the alert view will be displayed in.
  354. * @param title The text displayed on the button.
  355. * @param subTitle The subtitle text of the alert view.
  356. * @param closeButtonTitle The text for the close button.
  357. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  358. */
  359. - (void)showInfo:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  360. - (void)showInfo:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  361. /** Show Edit SCLAlertView
  362. *
  363. * @param vc The view controller the alert view will be displayed in.
  364. * @param title The text displayed on the button.
  365. * @param subTitle The subtitle text of the alert view.
  366. * @param closeButtonTitle The text for the close button.
  367. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  368. */
  369. - (void)showEdit:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  370. - (void)showEdit:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  371. /** Show Title SCLAlertView using a predefined type
  372. *
  373. * @param vc The view controller the alert view will be displayed in.
  374. * @param title The text displayed on the button.
  375. * @param subTitle The subtitle text of the alert view.
  376. * @param style One of predefined SCLAlertView styles.
  377. * @param closeButtonTitle The text for the close button.
  378. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  379. */
  380. - (void)showTitle:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle style:(SCLAlertViewStyle)style closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  381. - (void)showTitle:(NSString *)title subTitle:(NSString *)subTitle style:(SCLAlertViewStyle)style closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  382. /** Shows a custom SCLAlertView without using a predefined type, allowing for a custom image and color to be specified.
  383. *
  384. * @param vc The view controller the alert view will be displayed in.
  385. * @param image A UIImage object to be used as the icon for the alert view.
  386. * @param color A UIColor object to be used to tint the background of the icon circle and the buttons.
  387. * @param title The title text of the alert view.
  388. * @param subTitle The subtitle text of the alert view.
  389. * @param closeButtonTitle The text for the close button.
  390. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  391. */
  392. - (void)showCustom:(UIViewController *)vc image:(UIImage *)image color:(UIColor *)color title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  393. - (void)showCustom:(UIImage *)image color:(UIColor *)color title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  394. /** Show Waiting SCLAlertView with UIActityIndicator.
  395. *
  396. * @param vc The view controller the alert view will be displayed in.
  397. * @param title The text displayed on the button.
  398. * @param subTitle The subtitle text of the alert view.
  399. * @param closeButtonTitle The text for the close button.
  400. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  401. */
  402. - (void)showWaiting:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  403. - (void)showWaiting:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  404. /** Show Question SCLAlertView
  405. *
  406. * @param vc The view controller the alert view will be displayed in.
  407. * @param title The text displayed on the button.
  408. * @param subTitle The subtitle text of the alert view.
  409. * @param closeButtonTitle The text for the close button.
  410. * @param duration The amount of time the alert will remain on screen until it is automatically dismissed. If automatic dismissal is not desired, set to 0.
  411. */
  412. - (void)showQuestion:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  413. - (void)showQuestion:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
  414. @end
  415. @protocol SCLItemsBuilder__Protocol__Fluent <NSObject>
  416. - (void)setupFluent;
  417. @end
  418. @interface SCLAlertViewBuilder__WithFluent: NSObject <SCLItemsBuilder__Protocol__Fluent> @end
  419. @interface SCLAlertViewShowBuilder : SCLAlertViewBuilder__WithFluent
  420. @property(weak, nonatomic, readonly) UIViewController *parameterViewController;
  421. @property(copy, nonatomic, readonly) UIImage *parameterImage;
  422. @property(copy, nonatomic, readonly) UIColor *parameterColor;
  423. @property(copy, nonatomic, readonly) NSString *parameterTitle;
  424. @property(copy, nonatomic, readonly) NSString *parameterSubTitle;
  425. @property(copy, nonatomic, readonly) NSString *parameterCompleteText;
  426. @property(copy, nonatomic, readonly) NSString *parameterCloseButtonTitle;
  427. @property(assign, nonatomic, readonly) SCLAlertViewStyle parameterStyle;
  428. @property(assign, nonatomic, readonly) NSTimeInterval parameterDuration;
  429. #pragma mark - Setters
  430. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^viewController)(UIViewController *viewController);
  431. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^image)(UIImage *image);
  432. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^color)(UIColor *color);
  433. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^title)(NSString *title);
  434. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^subTitle)(NSString *subTitle);
  435. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^completeText)(NSString *completeText);
  436. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^style)(SCLAlertViewStyle style);
  437. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^closeButtonTitle)(NSString *closeButtonTitle);
  438. @property(copy, nonatomic, readonly) SCLAlertViewShowBuilder *(^duration)(NSTimeInterval duration);
  439. - (void)showAlertView:(SCLAlertView *)alertView;
  440. - (void)showAlertView:(SCLAlertView *)alertView onViewController:(UIViewController *)controller;
  441. @property(copy, nonatomic, readonly) void (^show)(SCLAlertView *view, UIViewController *controller);
  442. @end
  443. @interface SCLALertViewTextFieldBuilder : SCLAlertViewBuilder__WithFluent
  444. #pragma mark - Available later after adding
  445. @property(weak, nonatomic, readonly) SCLTextView *textField;
  446. #pragma mark - Setters
  447. @property(copy, nonatomic, readonly) SCLALertViewTextFieldBuilder *(^title) (NSString *title);
  448. @end
  449. @interface SCLALertViewButtonBuilder : SCLAlertViewBuilder__WithFluent
  450. #pragma mark - Available later after adding
  451. @property(weak, nonatomic, readonly) SCLButton *button;
  452. #pragma mark - Setters
  453. @property(copy, nonatomic, readonly) SCLALertViewButtonBuilder *(^title) (NSString *title);
  454. @property(copy, nonatomic, readonly) SCLALertViewButtonBuilder *(^target) (id target);
  455. @property(copy, nonatomic, readonly) SCLALertViewButtonBuilder *(^selector) (SEL selector);
  456. @property(copy, nonatomic, readonly) SCLALertViewButtonBuilder *(^actionBlock) (void(^actionBlock)(void));
  457. @property(copy, nonatomic, readonly) SCLALertViewButtonBuilder *(^validationBlock) (BOOL(^validationBlock)(void));
  458. @end
  459. @interface SCLAlertViewBuilder : SCLAlertViewBuilder__WithFluent
  460. #pragma mark - Parameters
  461. @property (strong, nonatomic, readonly) SCLAlertView *alertView;
  462. #pragma mark - Init
  463. - (instancetype)init;
  464. - (instancetype)initWithNewWindow;
  465. - (instancetype)initWithNewWindowWidth:(CGFloat)width;
  466. #pragma mark - Properties
  467. @property(copy, nonatomic) SCLAlertViewBuilder *(^cornerRadius) (CGFloat cornerRadius);
  468. @property(copy, nonatomic) SCLAlertViewBuilder *(^tintTopCircle) (BOOL tintTopCircle);
  469. @property(copy, nonatomic) SCLAlertViewBuilder *(^useLargerIcon) (BOOL useLargerIcon);
  470. @property(copy, nonatomic) SCLAlertViewBuilder *(^labelTitle) (UILabel *labelTitle);
  471. @property(copy, nonatomic) SCLAlertViewBuilder *(^viewText) (UITextView *viewText);
  472. @property(copy, nonatomic) SCLAlertViewBuilder *(^activityIndicatorView) (UIActivityIndicatorView *activityIndicatorView);
  473. @property(copy, nonatomic) SCLAlertViewBuilder *(^shouldDismissOnTapOutside) (BOOL shouldDismissOnTapOutside);
  474. @property(copy, nonatomic) SCLAlertViewBuilder *(^soundURL) (NSURL *soundURL);
  475. @property(copy, nonatomic) SCLAlertViewBuilder *(^attributedFormatBlock) (SCLAttributedFormatBlock attributedFormatBlock);
  476. @property(copy, nonatomic) SCLAlertViewBuilder *(^completeButtonFormatBlock) (CompleteButtonFormatBlock completeButtonFormatBlock);
  477. @property(copy, nonatomic) SCLAlertViewBuilder *(^buttonFormatBlock) (ButtonFormatBlock buttonFormatBlock);
  478. @property(copy, nonatomic) SCLAlertViewBuilder *(^forceHideBlock) (SCLForceHideBlock forceHideBlock);
  479. @property(copy, nonatomic) SCLAlertViewBuilder *(^hideAnimationType) (SCLAlertViewHideAnimation hideAnimationType);
  480. @property(copy, nonatomic) SCLAlertViewBuilder *(^showAnimationType) (SCLAlertViewShowAnimation showAnimationType);
  481. @property(copy, nonatomic) SCLAlertViewBuilder *(^backgroundType) (SCLAlertViewBackground backgroundType);
  482. @property(copy, nonatomic) SCLAlertViewBuilder *(^customViewColor) (UIColor *customViewColor);
  483. @property(copy, nonatomic) SCLAlertViewBuilder *(^backgroundViewColor) (UIColor *backgroundViewColor);
  484. @property(copy, nonatomic) SCLAlertViewBuilder *(^iconTintColor) (UIColor *iconTintColor);
  485. @property(copy, nonatomic) SCLAlertViewBuilder *(^circleIconHeight) (CGFloat circleIconHeight);
  486. @property(copy, nonatomic) SCLAlertViewBuilder *(^extensionBounds) (CGRect extensionBounds);
  487. @property(copy, nonatomic) SCLAlertViewBuilder *(^statusBarHidden) (BOOL statusBarHidden);
  488. @property(copy, nonatomic) SCLAlertViewBuilder *(^statusBarStyle) (UIStatusBarStyle statusBarStyle);
  489. #pragma mark - Custom Setters
  490. @property(copy, nonatomic) SCLAlertViewBuilder *(^alertIsDismissed) (SCLDismissBlock dismissBlock);
  491. @property(copy, nonatomic) SCLAlertViewBuilder *(^alertDismissAnimationIsCompleted) (SCLDismissAnimationCompletionBlock dismissAnimationCompletionBlock);
  492. @property(copy, nonatomic) SCLAlertViewBuilder *(^alertShowAnimationIsCompleted) (SCLShowAnimationCompletionBlock showAnimationCompletionBlock);
  493. @property(copy, nonatomic) SCLAlertViewBuilder *(^removeTopCircle)(void);
  494. @property(copy, nonatomic) SCLAlertViewBuilder *(^addCustomView)(UIView *view);
  495. @property(copy, nonatomic) SCLAlertViewBuilder *(^addTextField)(NSString *title, NSString *defaultText);
  496. @property(copy, nonatomic) SCLAlertViewBuilder *(^addCustomTextField)(UITextField *textField);
  497. @property(copy, nonatomic) SCLAlertViewBuilder *(^addSwitchViewWithLabelTitle)(NSString *title);
  498. @property(copy, nonatomic) SCLAlertViewBuilder *(^addTimerToButtonIndex)(NSInteger buttonIndex, BOOL reverse);
  499. @property(copy, nonatomic) SCLAlertViewBuilder *(^setTitleFontFamily)(NSString *titleFontFamily, CGFloat size);
  500. @property(copy, nonatomic) SCLAlertViewBuilder *(^setBodyTextFontFamily)(NSString *bodyTextFontFamily, CGFloat size);
  501. @property(copy, nonatomic) SCLAlertViewBuilder *(^setButtonsTextFontFamily)(NSString *buttonsFontFamily, CGFloat size);
  502. @property(copy, nonatomic) SCLAlertViewBuilder *(^addButtonWithActionBlock)(NSString *title, SCLActionBlock action);
  503. @property(copy, nonatomic) SCLAlertViewBuilder *(^addButtonWithValidationBlock)(NSString *title, SCLValidationBlock validationBlock, SCLActionBlock action);
  504. @property(copy, nonatomic) SCLAlertViewBuilder *(^addButtonWithTarget)(NSString *title, id target, SEL selector);
  505. #pragma mark - Builders
  506. @property(copy, nonatomic) SCLAlertViewBuilder *(^addButtonWithBuilder)(SCLALertViewButtonBuilder *builder);
  507. @property(copy, nonatomic) SCLAlertViewBuilder *(^addTextFieldWithBuilder)(SCLALertViewTextFieldBuilder *builder);
  508. @end