Skip to content

Commit a86015b

Browse files
author
Diogo Autilio
committed
Support SCLAlert using UIViewController and using a new window
1 parent d7df5d0 commit a86015b

3 files changed

Lines changed: 155 additions & 95 deletions

File tree

SCLAlertView/SCLAlertView.h

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground)
168168
*/
169169
@property (nonatomic) CGFloat circleIconHeight;
170170

171+
/** Initialize SCLAlertView using a new window.
172+
*
173+
* Init with new window
174+
*/
175+
- (instancetype)initWithNewWindow;
176+
171177
/** Warns that alerts is gone
172178
*
173179
* Warns that alerts is gone using block
@@ -257,87 +263,96 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground)
257263

258264
/** Show Success SCLAlertView
259265
*
266+
* @param vc The view controller the alert view will be displayed in.
260267
* @param title The text displayed on the button.
261268
* @param subTitle The subtitle text of the alert view.
262269
* @param closeButtonTitle The text for the close button.
263270
* @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.
264271
*/
265-
- (void)showSuccess:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
272+
- (void)showSuccess:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
266273

267274
/** Show Error SCLAlertView
268275
*
276+
* @param vc The view controller the alert view will be displayed in.
269277
* @param title The text displayed on the button.
270278
* @param subTitle The subtitle text of the alert view.
271279
* @param closeButtonTitle The text for the close button.
272280
* @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.
273281
*/
274-
- (void)showError:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
282+
- (void)showError:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
275283

276284
/** Show Notice SCLAlertView
277285
*
286+
* @param vc The view controller the alert view will be displayed in.
278287
* @param title The text displayed on the button.
279288
* @param subTitle The subtitle text of the alert view.
280289
* @param closeButtonTitle The text for the close button.
281290
* @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.
282291
*/
283-
- (void)showNotice:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
292+
- (void)showNotice:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
284293

285294
/** Show Warning SCLAlertView
286295
*
296+
* @param vc The view controller the alert view will be displayed in.
287297
* @param title The text displayed on the button.
288298
* @param subTitle The subtitle text of the alert view.
289299
* @param closeButtonTitle The text for the close button.
290300
* @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.
291301
*/
292-
- (void)showWarning:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
302+
- (void)showWarning:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
293303

294304
/** Show Info SCLAlertView
295305
*
306+
* @param vc The view controller the alert view will be displayed in.
296307
* @param title The text displayed on the button.
297308
* @param subTitle The subtitle text of the alert view.
298309
* @param closeButtonTitle The text for the close button.
299310
* @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.
300311
*/
301-
- (void)showInfo:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
312+
- (void)showInfo:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
302313

303314
/** Show Edit SCLAlertView
304315
*
316+
* @param vc The view controller the alert view will be displayed in.
305317
* @param title The text displayed on the button.
306318
* @param subTitle The subtitle text of the alert view.
307319
* @param closeButtonTitle The text for the close button.
308320
* @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.
309321
*/
310-
- (void)showEdit:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
322+
- (void)showEdit:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
311323

312324
/** Show Title SCLAlertView using a predefined type
313325
*
326+
* @param vc The view controller the alert view will be displayed in.
314327
* @param title The text displayed on the button.
315328
* @param subTitle The subtitle text of the alert view.
316329
* @param style One of predefined SCLAlertView styles.
317330
* @param closeButtonTitle The text for the close button.
318331
* @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.
319332
*/
320-
- (void)showTitle:(NSString *)title subTitle:(NSString *)subTitle style:(SCLAlertViewStyle)style closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
333+
- (void)showTitle:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle style:(SCLAlertViewStyle)style closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
321334

322335
/** Shows a custom SCLAlertView without using a predefined type, allowing for a custom image and color to be specified.
323336
*
337+
* @param vc The view controller the alert view will be displayed in.
324338
* @param image A UIImage object to be used as the icon for the alert view.
325339
* @param color A UIColor object to be used to tint the background of the icon circle and the buttons.
326340
* @param title The title text of the alert view.
327341
* @param subTitle The subtitle text of the alert view.
328342
* @param closeButtonTitle The text for the close button.
329343
* @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.
330344
*/
331-
- (void)showCustom:(UIImage *)image color:(UIColor *)color title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
345+
- (void)showCustom:(UIViewController *)vc image:(UIImage *)image color:(UIColor *)color title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
332346

333347
/** Show Waiting SCLAlertView with UIActityIndicator.
334348
*
349+
* @param vc The view controller the alert view will be displayed in.
335350
* @param title The text displayed on the button.
336351
* @param subTitle The subtitle text of the alert view.
337352
* @param closeButtonTitle The text for the close button.
338353
* @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.
339354
*/
340-
- (void)showWaiting:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
355+
- (void)showWaiting:(UIViewController *)vc title:(NSString *)title subTitle:(NSString *)subTitle closeButtonTitle:(NSString *)closeButtonTitle duration:(NSTimeInterval)duration;
341356

342357

343358
@end

0 commit comments

Comments
 (0)