From adcecb29ee087e7e26cface97ff0500226e4f21e Mon Sep 17 00:00:00 2001 From: Fernando Reynoso Date: Thu, 8 Jun 2023 15:04:18 -0700 Subject: [PATCH] Add initWithWidth method for setting the width of the object. --- SCLAlertView/SCLAlertView.h | 6 ++++++ SCLAlertView/SCLAlertView.m | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/SCLAlertView/SCLAlertView.h b/SCLAlertView/SCLAlertView.h index 33ec029..1df8008 100755 --- a/SCLAlertView/SCLAlertView.h +++ b/SCLAlertView/SCLAlertView.h @@ -230,6 +230,12 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) */ @property (nonatomic) BOOL horizontalButtons; +/** Initialize SCLAlertView using specific width. + * + * Init instance + */ +- (instancetype)initWithWidth:(CGFloat)width; + /** Initialize SCLAlertView using a new window. * * Init with new window diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 20a22dc..909b907 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -96,6 +96,16 @@ - (instancetype)init return self; } +- (instancetype)initWithWidth:(CGFloat)width +{ + self = [super init]; + if (self) + { + [self setupViewWindowWidth:width]; + } + return self; +} + - (instancetype)initWithWindowWidth:(CGFloat)windowWidth { self = [super init];