diff --git a/CHANGELOG.md b/CHANGELOG.md index 2022b3b..47ecbc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 1.2.1 unreleased + +* add: alertViewBackgroundWidth delegate method + + ## [1.1.4](https://github.com/dogo/SCLAlertView/tree/1.1.4) (2018-06-19) [Full Changelog](https://github.com/dogo/SCLAlertView/compare/1.1.3...1.1.4) diff --git a/SCLAlertView-Objective-C.podspec b/SCLAlertView-Objective-C.podspec index cfb5881..e69b0d1 100644 --- a/SCLAlertView-Objective-C.podspec +++ b/SCLAlertView-Objective-C.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "SCLAlertView-Objective-C" - spec.version = "1.2.0" + spec.version = "1.2.1" spec.summary = "Beautiful animated Alert View. Written in Swift but ported to Objective-C" spec.homepage = "https://github.com/dogo/SCLAlertView" spec.screenshots = "https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot.png", "https://raw.githubusercontent.com/dogo/SCLAlertView/master/ScreenShots/ScreenShot2.png" diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 20a22dc..d9f6962 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -1161,6 +1161,18 @@ - (SCLForceHideBlock)forceHideBlock:(SCLForceHideBlock)forceHideBlock - (CGRect)mainScreenFrame { + if (_rootViewController) { + if ([_rootViewController respondsToSelector:@selector(alertViewBackgroundWidth)]) { + NSInvocationOperation *invo = [[NSInvocationOperation alloc] initWithTarget:_rootViewController selector:@selector(alertViewBackgroundWidth) object:nil]; + [invo start]; + CGFloat width = 0; + [invo.result getValue:&width]; + CGRect rect = [UIApplication sharedApplication].keyWindow.bounds; + rect.size.width = width; + return rect; + } + } + return [self isAppExtension] ? _extensionBounds : [UIApplication sharedApplication].keyWindow.bounds; }