From 3f8b3bbe7ce1246c1338f324e1f5f640812bfad9 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Thu, 12 Nov 2015 20:03:21 +0800 Subject: [PATCH 01/38] add cocoa pod --- LICENSE | 22 ++++++++++++++++++++++ TYAlertController.podspec | 24 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 LICENSE create mode 100644 TYAlertController.podspec diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..b0217ba --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 tany + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/TYAlertController.podspec b/TYAlertController.podspec new file mode 100644 index 0000000..bdfd374 --- /dev/null +++ b/TYAlertController.podspec @@ -0,0 +1,24 @@ +Pod::Spec.new do |s| +# 名称 使用的时候pod search [name] +s.name = "TYAlertController" +# 代码库的版本 +s.version = "1.0.0" +# 简介 +s.summary = "Powerful, Easy to use alertview or popup view on controller and window, support blur effects,custom view and animation." +# 主页 +s.homepage = "https://github.com/12207480/TYAlertController" +# 许可证书类型,要和仓库的LICENSE 的类型一致 +s.license = { :type => 'MIT', :file => 'LICENSE' } +# 作者名称 和 邮箱 +s.author = { "tany" => "122074809@qq.com" } +# 作者主页 s.social_media_url ="" +# 代码库最低支持的版本 +s.platform = :ios, "7.0" +# 代码的Clone 地址 和 tag 版本 +s.source = { :git => "https://github.com/12207480/TYAlertController.git", :tag => s.version.to_s } +# 如果使用pod 需要导入哪些资源 +s.source_files = "TYAlertControllerDemo/TYAlertController/**/*.{h,m}" +# s.resources = "**/*/*.bundle" +# 框架是否使用的ARC +s.requires_arc = true +end \ No newline at end of file From 44c012b4e74d93e4183631d146970dcf203737bd Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Thu, 12 Nov 2015 20:04:57 +0800 Subject: [PATCH 02/38] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 273e9e1..97a9756 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # TYAlertController Powerful, Easy to use alertView or popupView on controller and window, support blur effect, custom view and custom animation, use aotolayout.support iphone, ipad . +## CocoaPods +``` +pod 'TYAlertController', '~> 1.0.0' +``` + ### ScreenShot ![image](https://github.com/12207480/TYAlertController/blob/master/screenshot/TYAlertControllerDemo.gif) From 31f824cd8767c284ece1489d8989d0575bfe9e77 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 20:41:37 +0800 Subject: [PATCH 03/38] add alertView lifecycle block --- .../TYAlertController/TYAlertController.h | 9 ++++- .../TYAlertController/TYAlertController.m | 38 ++++++++++++++++++- .../TYAlertController/TYAlertView.m | 8 ++-- TYAlertControllerDemo/ViewController.m | 21 ++++++++++ 4 files changed, 70 insertions(+), 6 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.h b/TYAlertControllerDemo/TYAlertController/TYAlertController.h index 7ff97d4..0b12b75 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.h +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.h @@ -42,7 +42,14 @@ typedef NS_ENUM(NSInteger, TYAlertTransitionAnimation) { @property (nonatomic, assign) CGFloat alertStyleEdging; // when width frame equal to 0,or no width constraint ,this proprty will use, default to 15 edge @property (nonatomic, assign) CGFloat actionSheetStyleEdging; // default 0 -@property (nonatomic, copy) void (^dismissComplete)(void); // dismiss controller completed block +// alertView lifecycle block +@property (strong, nonatomic) void (^viewWillShowHandler)(UIView *alertView); +@property (strong, nonatomic) void (^viewDidShowHandler)(UIView *alertView); +@property (strong, nonatomic) void (^viewWillHideHandler)(UIView *alertView); +@property (strong, nonatomic) void (^viewDidHideHandler)(UIView *alertView); + +// dismiss controller completed block +@property (nonatomic, copy) void (^dismissComplete)(void); + (instancetype)alertControllerWithAlertView:(UIView *)alertView; diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.m b/TYAlertControllerDemo/TYAlertController/TYAlertController.m index cc7267c..3995269 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.m @@ -121,6 +121,42 @@ - (void)viewDidLoad { } +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + if (_viewWillShowHandler) { + _viewWillShowHandler(_alertView); + } +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + if (_viewDidShowHandler) { + _viewDidShowHandler(_alertView); + } +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + + if (_viewWillHideHandler) { + _viewWillHideHandler(_alertView); + } +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + + if (_viewDidHideHandler) { + _viewDidHideHandler(_alertView); + } +} + - (void)addBackgroundView { if (_backgroundView == nil) { @@ -305,7 +341,7 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; - NSLog(@"%@ dealloc",NSStringFromClass([self class])); + //NSLog(@"%@ dealloc",NSStringFromClass([self class])); } @end diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index e844ade..ad55fe9 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -393,9 +393,9 @@ - (void)actionButtonClicked:(UIButton *)button } } -- (void)dealloc -{ - NSLog(@"%@ dealloc",NSStringFromClass([self class])); -} +//- (void)dealloc +//{ +// NSLog(@"%@ dealloc",NSStringFromClass([self class])); +//} @end diff --git a/TYAlertControllerDemo/ViewController.m b/TYAlertControllerDemo/ViewController.m index ebb35a1..49f15d0 100644 --- a/TYAlertControllerDemo/ViewController.m +++ b/TYAlertControllerDemo/ViewController.m @@ -53,6 +53,27 @@ - (IBAction)showAlertViewAction:(id)sender { // first way to show TYAlertController *alertController = [TYAlertController alertControllerWithAlertView:alertView preferredStyle:TYAlertControllerStyleAlert]; + + [alertController setViewWillShowHandler:^(UIView *alertView) { + NSLog(@"ViewWillShow"); + }]; + + [alertController setViewDidShowHandler:^(UIView *alertView) { + NSLog(@"ViewDidShow"); + }]; + + [alertController setViewWillHideHandler:^(UIView *alertView) { + NSLog(@"ViewWillHide"); + }]; + + [alertController setViewDidHideHandler:^(UIView *alertView) { + NSLog(@"ViewDidHide"); + }]; + + [alertController setDismissComplete:^{ + NSLog(@"DismissComplete"); + }]; + //alertController.alertViewOriginY = 60; [self presentViewController:alertController animated:YES completion:nil]; From 7304949491aead5cf8d0ecc42f14271b072a9de9 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 20:55:26 +0800 Subject: [PATCH 04/38] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 97a9756..b1e4250 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,18 @@ pod 'TYAlertController', '~> 1.0.0' ### usege demo * show in controller (tow way) + +```objc +// alertView lifecycle block +@property (strong, nonatomic) void (^viewWillShowHandler)(UIView *alertView); +@property (strong, nonatomic) void (^viewDidShowHandler)(UIView *alertView); +@property (strong, nonatomic) void (^viewWillHideHandler)(UIView *alertView); +@property (strong, nonatomic) void (^viewDidHideHandler)(UIView *alertView); + +// dismiss controller completed block +@property (nonatomic, copy) void (^dismissComplete)(void); +``` + ```objc TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "]; From 7506d53076b53fe25f5958811bf9e9ae37ba032e Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 20:56:37 +0800 Subject: [PATCH 05/38] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b1e4250..4310aa5 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ pod 'TYAlertController', '~> 1.0.0' * show in controller (tow way) + block ```objc // alertView lifecycle block @property (strong, nonatomic) void (^viewWillShowHandler)(UIView *alertView); @@ -36,6 +37,7 @@ pod 'TYAlertController', '~> 1.0.0' @property (nonatomic, copy) void (^dismissComplete)(void); ``` + demo ```objc TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "]; From 30b1661fa84e2f7ff58116bf0e57284ef743013f Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 20:57:35 +0800 Subject: [PATCH 06/38] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4310aa5..292ace2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ pod 'TYAlertController', '~> 1.0.0' * show in controller (tow way) - block + **block ```objc // alertView lifecycle block @property (strong, nonatomic) void (^viewWillShowHandler)(UIView *alertView); @@ -37,7 +37,7 @@ pod 'TYAlertController', '~> 1.0.0' @property (nonatomic, copy) void (^dismissComplete)(void); ``` - demo +**demo ```objc TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "]; From 3d77c78251f87745e873184a5852d65ea02f6289 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 20:58:35 +0800 Subject: [PATCH 07/38] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 292ace2..dee93a0 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,7 @@ pod 'TYAlertController', '~> 1.0.0' ### usege demo -* show in controller (tow way) - - **block +* alertView lifecycle block ```objc // alertView lifecycle block @property (strong, nonatomic) void (^viewWillShowHandler)(UIView *alertView); @@ -37,7 +35,7 @@ pod 'TYAlertController', '~> 1.0.0' @property (nonatomic, copy) void (^dismissComplete)(void); ``` -**demo +* show in controller (tow way) ```objc TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "]; From 02dba2459fb094eaf243377cd617edf86c8861c5 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 21:00:11 +0800 Subject: [PATCH 08/38] clean --- .../project.pbxproj | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/TYAlertControllerDemo.xcodeproj/project.pbxproj b/TYAlertControllerDemo.xcodeproj/project.pbxproj index 6891071..ebc98fe 100644 --- a/TYAlertControllerDemo.xcodeproj/project.pbxproj +++ b/TYAlertControllerDemo.xcodeproj/project.pbxproj @@ -285,6 +285,7 @@ TargetAttributes = { D358541D1B9532D700B5FA1F = { CreatedOnToolsVersion = 6.4; + DevelopmentTeam = ZW52Q3KXX4; }; D35854361B9532D700B5FA1F = { CreatedOnToolsVersion = 6.4; @@ -414,7 +415,8 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -433,7 +435,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -458,7 +460,8 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; @@ -471,7 +474,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -483,10 +486,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = TYAlertControllerDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tanyang.TYAlertControllerDemo; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Debug; }; @@ -494,10 +501,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = TYAlertControllerDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tanyang.TYAlertControllerDemo; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Release; }; From 09984df4d2043d1c438604708189283e7d140af7 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 21:27:35 +0800 Subject: [PATCH 09/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dee93a0..6c4b8cd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Powerful, Easy to use alertView or popupView on controller and window, support b ## CocoaPods ``` -pod 'TYAlertController', '~> 1.0.0' +pod 'TYAlertController', '~> 1.1.0' ``` ### ScreenShot From a78b078371a623151aaacf02491849978f875c26 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 22:11:43 +0800 Subject: [PATCH 10/38] add alertView lifecycle block --- TYAlertController.podspec | 2 +- .../TYAlertController/TYAlertController.m | 10 ++++++++-- .../TYAlertController/TYShowAlertView.h | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/TYAlertController.podspec b/TYAlertController.podspec index bdfd374..e170c4b 100644 --- a/TYAlertController.podspec +++ b/TYAlertController.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| # 名称 使用的时候pod search [name] s.name = "TYAlertController" # 代码库的版本 -s.version = "1.0.0" +s.version = "1.1.2" # 简介 s.summary = "Powerful, Easy to use alertview or popup view on controller and window, support blur effects,custom view and animation." # 主页 diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.m b/TYAlertControllerDemo/TYAlertController/TYAlertController.m index 3995269..7b6d3c4 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.m @@ -285,9 +285,15 @@ - (void)layoutAlertStyleView - (void)layoutActionSheetStyleView { - // center X - [self.view addConstraintCenterXToView:_alertView CenterYToView:nil]; + // remove width constaint + for (NSLayoutConstraint *constraint in _alertView.constraints) { + if (constraint.firstAttribute == NSLayoutAttributeWidth) { + [_alertView removeConstraint: constraint]; + break; + } + } + // add edge constraint [self.view addConstarintWithView:_alertView topView:nil leftView:self.view bottomView:self.view rightView:self.view edageInset:UIEdgeInsetsMake(0, _actionSheetStyleEdging, 0, -_actionSheetStyleEdging)]; if (CGRectGetHeight(_alertView.frame) > 0) { diff --git a/TYAlertControllerDemo/TYAlertController/TYShowAlertView.h b/TYAlertControllerDemo/TYAlertController/TYShowAlertView.h index ba23388..11e185e 100644 --- a/TYAlertControllerDemo/TYAlertController/TYShowAlertView.h +++ b/TYAlertControllerDemo/TYAlertController/TYShowAlertView.h @@ -17,7 +17,6 @@ @property (nonatomic, assign) CGFloat alertViewOriginY; // default center Y @property (nonatomic, assign) CGFloat alertViewEdging; // default 15 - +(void)showAlertViewWithView:(UIView *)alertView; + (void)showAlertViewWithView:(UIView *)alertView backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable; From fdecb144b95eef659e0dd74cf9b4d626d76dd7c9 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Sun, 15 Nov 2015 22:15:30 +0800 Subject: [PATCH 11/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c4b8cd..551972a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Powerful, Easy to use alertView or popupView on controller and window, support b ## CocoaPods ``` -pod 'TYAlertController', '~> 1.1.0' +pod 'TYAlertController', '~> 1.1.2' ``` ### ScreenShot From 20be044fd38bb3dfc9ddcb0cd657f7fc53ac4cbe Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Wed, 18 Nov 2015 08:51:26 +0800 Subject: [PATCH 12/38] block should copy --- .../TYAlertController/TYAlertController.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.h b/TYAlertControllerDemo/TYAlertController/TYAlertController.h index 0b12b75..583f8f5 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.h +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.h @@ -43,10 +43,10 @@ typedef NS_ENUM(NSInteger, TYAlertTransitionAnimation) { @property (nonatomic, assign) CGFloat actionSheetStyleEdging; // default 0 // alertView lifecycle block -@property (strong, nonatomic) void (^viewWillShowHandler)(UIView *alertView); -@property (strong, nonatomic) void (^viewDidShowHandler)(UIView *alertView); -@property (strong, nonatomic) void (^viewWillHideHandler)(UIView *alertView); -@property (strong, nonatomic) void (^viewDidHideHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewWillShowHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewDidShowHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewWillHideHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewDidHideHandler)(UIView *alertView); // dismiss controller completed block @property (nonatomic, copy) void (^dismissComplete)(void); From d268fb3b8b82495a26c1d4895ca3245cd8e86b80 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Wed, 18 Nov 2015 08:52:00 +0800 Subject: [PATCH 13/38] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 551972a..da3df6f 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,10 @@ pod 'TYAlertController', '~> 1.1.2' * alertView lifecycle block ```objc // alertView lifecycle block -@property (strong, nonatomic) void (^viewWillShowHandler)(UIView *alertView); -@property (strong, nonatomic) void (^viewDidShowHandler)(UIView *alertView); -@property (strong, nonatomic) void (^viewWillHideHandler)(UIView *alertView); -@property (strong, nonatomic) void (^viewDidHideHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewWillShowHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewDidShowHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewWillHideHandler)(UIView *alertView); +@property (copy, nonatomic) void (^viewDidHideHandler)(UIView *alertView); // dismiss controller completed block @property (nonatomic, copy) void (^dismissComplete)(void); From 45d66b5aa53d20890ca9ffb82d6faedf73378f00 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Wed, 18 Nov 2015 19:25:36 +0800 Subject: [PATCH 14/38] update cocoa pod --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c4b8cd..551972a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Powerful, Easy to use alertView or popupView on controller and window, support b ## CocoaPods ``` -pod 'TYAlertController', '~> 1.1.0' +pod 'TYAlertController', '~> 1.1.2' ``` ### ScreenShot From 41588123c5ea0dd39c24ebc033e800f82416eae6 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Wed, 18 Nov 2015 19:50:59 +0800 Subject: [PATCH 15/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da3df6f..6514d65 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Powerful, Easy to use alertView or popupView on controller and window, support b ## CocoaPods ``` -pod 'TYAlertController', '~> 1.1.2' +pod 'TYAlertController', '~> 1.1.3' ``` ### ScreenShot From 726fa5e5a1b9f02fb41345b32f13ef91ce89e850 Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Tue, 7 Jun 2016 21:38:24 +0800 Subject: [PATCH 16/38] fix keyboard change frame incorrect --- TYAlertController.podspec | 2 +- TYAlertControllerDemo/TYAlertController/TYAlertController.m | 5 +++-- TYAlertControllerDemo/ViewController.m | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TYAlertController.podspec b/TYAlertController.podspec index e170c4b..7ba6573 100644 --- a/TYAlertController.podspec +++ b/TYAlertController.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| # 名称 使用的时候pod search [name] s.name = "TYAlertController" # 代码库的版本 -s.version = "1.1.2" +s.version = "1.1.3" # 简介 s.summary = "Powerful, Easy to use alertview or popup view on controller and window, support blur effects,custom view and animation." # 主页 diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.m b/TYAlertControllerDemo/TYAlertController/TYAlertController.m index 7b6d3c4..b6bf870 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.m @@ -319,10 +319,10 @@ - (void)singleTap:(UITapGestureRecognizer *)sender - (void)keyboardWillShow:(NSNotification*)notification{ CGRect keyboardRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; - CGFloat alertViewBottomEdge = CGRectGetHeight(self.view.frame) - CGRectGetMaxY(_alertView.frame); + CGFloat alertViewBottomEdge = (CGRectGetHeight(self.view.frame) - CGRectGetHeight(_alertView.frame))/2 - _alertViewCenterYOffset; CGFloat differ = CGRectGetHeight(keyboardRect) - alertViewBottomEdge; - if (differ > 0) { + if (differ >= 0) { _alertViewCenterYConstraint.constant = _alertViewCenterYOffset - differ; [UIView animateWithDuration:0.25 animations:^{ [self.view layoutIfNeeded]; @@ -330,6 +330,7 @@ - (void)keyboardWillShow:(NSNotification*)notification{ } } + - (void)keyboardWillHide:(NSNotification*)notification{ _alertViewCenterYConstraint.constant = _alertViewCenterYOffset; diff --git a/TYAlertControllerDemo/ViewController.m b/TYAlertControllerDemo/ViewController.m index 49f15d0..cc064ea 100644 --- a/TYAlertControllerDemo/ViewController.m +++ b/TYAlertControllerDemo/ViewController.m @@ -23,6 +23,7 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. + } From 91e8211eefcd68bd846ff66637465109500a07bf Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Tue, 7 Jun 2016 21:41:24 +0800 Subject: [PATCH 17/38] add pod version --- TYAlertController.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TYAlertController.podspec b/TYAlertController.podspec index 7ba6573..e582a45 100644 --- a/TYAlertController.podspec +++ b/TYAlertController.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| # 名称 使用的时候pod search [name] s.name = "TYAlertController" # 代码库的版本 -s.version = "1.1.3" +s.version = "1.1.6" # 简介 s.summary = "Powerful, Easy to use alertview or popup view on controller and window, support blur effects,custom view and animation." # 主页 From 6e6f9bee544044eaa23e95c8059d4bddea23c816 Mon Sep 17 00:00:00 2001 From: tany <122074809@qq.com> Date: Wed, 8 Jun 2016 09:57:46 +0800 Subject: [PATCH 18/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6514d65..70cea27 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Powerful, Easy to use alertView or popupView on controller and window, support b ## CocoaPods ``` -pod 'TYAlertController', '~> 1.1.3' +pod 'TYAlertController', '~> 1.1.6' ``` ### ScreenShot From bbcab0b43c3eb733a1b202fa955b450365afd6eb Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Mon, 29 Aug 2016 09:34:04 +0800 Subject: [PATCH 19/38] fixed spelling mistakes --- .../TYAlertController/TYAlertView.h | 11 +- .../TYAlertController/TYAlertView.m | 110 +++++++++--------- 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.h b/TYAlertControllerDemo/TYAlertController/TYAlertView.h index c85eb87..ecc6489 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.h +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.h @@ -30,6 +30,7 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) { @property (nonatomic, weak, readonly) UILabel *titleLable; @property (nonatomic, weak, readonly) UILabel *messageLabel; +// alertView textfield array @property (nonatomic, strong, readonly) NSArray *textFieldArray; // default 280, if 0 don't add width constraint, @@ -52,14 +53,14 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) { @property (nonatomic, strong) UIColor *buttonCancleBgColor; @property (nonatomic, strong) UIColor *buttonDestructiveBgColor; -// textFeild custom +// textField custom @property (nonatomic, strong) UIColor *textFieldBorderColor; @property (nonatomic, strong) UIColor *textFieldBackgroudColor; @property (nonatomic, strong) UIFont *textFieldFont; -@property (nonatomic, assign) CGFloat textFeildHeight; -@property (nonatomic, assign) CGFloat textFeildEdge; -@property (nonatomic, assign) CGFloat textFeildorderWidth; -@property (nonatomic, assign) CGFloat textFeildContentViewEdge; +@property (nonatomic, assign) CGFloat textFieldHeight; +@property (nonatomic, assign) CGFloat textFieldEdge; +@property (nonatomic, assign) CGFloat textFieldorderWidth; +@property (nonatomic, assign) CGFloat textFieldContentViewEdge; + (instancetype)alertViewWithTitle:(NSString *)title message:(NSString *)message; diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index ad55fe9..2264951 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -53,10 +53,10 @@ @interface TYAlertView () @property (nonatomic, weak) UILabel *titleLable; @property (nonatomic, weak) UILabel *messageLabel; -@property (nonatomic, weak) UIView *textFeildContentView; -@property (nonatomic, weak) NSLayoutConstraint *textFeildTopConstraint; -@property (nonatomic, strong) NSMutableArray *textFeilds; -@property (nonatomic, strong) NSMutableArray *textFeildSeparateViews; +@property (nonatomic, weak) UIView *textFieldContentView; +@property (nonatomic, weak) NSLayoutConstraint *textFieldTopConstraint; +@property (nonatomic, strong) NSMutableArray *textFields; +@property (nonatomic, strong) NSMutableArray *textFieldSeparateViews; // button content View @property (nonatomic, weak) UIView *buttonContentView; @@ -76,10 +76,10 @@ @interface TYAlertView () #define kButtonSpace 6 #define KButtonHeight 44 -#define kTextFeildOffset 10000 -#define kTextFeildHeight 29 -#define kTextFeildEdge 8 -#define KTextFeildBorderWidth 0.5 +#define ktextFieldOffset 10000 +#define ktextFieldHeight 29 +#define ktextFieldEdge 8 +#define KtextFieldBorderWidth 0.5 @implementation TYAlertView @@ -136,10 +136,10 @@ - (void)configureProperty _buttonCancleBgColor = [UIColor colorWithRed:127/255.0 green:140/255.0 blue:141/255.0 alpha:1]; _buttonDestructiveBgColor = [UIColor colorWithRed:231/255.0 green:76/255.0 blue:60/255.0 alpha:1]; - _textFeildHeight = kTextFeildHeight; - _textFeildEdge = kTextFeildEdge; - _textFeildorderWidth = KTextFeildBorderWidth; - _textFeildContentViewEdge = kContentViewEdge; + _textFieldHeight = ktextFieldHeight; + _textFieldEdge = ktextFieldEdge; + _textFieldorderWidth = KtextFieldBorderWidth; + _textFieldContentViewEdge = kContentViewEdge; _textFieldBorderColor = [UIColor colorWithRed:203/255.0 green:203/255.0 blue:203/255.0 alpha:1]; _textFieldBackgroudColor = [UIColor whiteColor]; @@ -172,9 +172,9 @@ - (void)addContentViews [self addSubview:textContentView]; _textContentView = textContentView; - UIView *textFeildContentView = [[UIView alloc]init]; - [self addSubview:textFeildContentView]; - _textFeildContentView = textFeildContentView; + UIView *textFieldContentView = [[UIView alloc]init]; + [self addSubview:textFieldContentView]; + _textFieldContentView = textFieldContentView; UIView *buttonContentView = [[UIView alloc]init]; buttonContentView.userInteractionEnabled = YES; @@ -233,14 +233,14 @@ - (void)addAction:(TYAlertAction *)action [self layoutButtons]; } -- (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textFeild))configurationHandler +- (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))configurationHandler { - if (_textFeilds == nil) { - _textFeilds = [NSMutableArray array]; + if (_textFields == nil) { + _textFields = [NSMutableArray array]; } UITextField *textField = [[UITextField alloc]init]; - textField.tag = kTextFeildOffset + _textFeilds.count; + textField.tag = ktextFieldOffset + _textFields.count; textField.font = _textFieldFont; textField.translatesAutoresizingMaskIntoConstraints = NO; @@ -248,26 +248,26 @@ - (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textFeild))c configurationHandler(textField); } - [_textFeildContentView addSubview:textField]; - [_textFeilds addObject:textField]; + [_textFieldContentView addSubview:textField]; + [_textFields addObject:textField]; - if (_textFeilds.count > 1) { - if (_textFeildSeparateViews == nil) { - _textFeildSeparateViews = [NSMutableArray array]; + if (_textFields.count > 1) { + if (_textFieldSeparateViews == nil) { + _textFieldSeparateViews = [NSMutableArray array]; } UIView *separateView = [[UIView alloc]init]; separateView.backgroundColor = _textFieldBorderColor; separateView.translatesAutoresizingMaskIntoConstraints = NO; - [_textFeildContentView addSubview:separateView]; - [_textFeildSeparateViews addObject:separateView]; + [_textFieldContentView addSubview:separateView]; + [_textFieldSeparateViews addObject:separateView]; } - [self layoutTextFeilds]; + [self layouttextFields]; } - (NSArray *)textFieldArray { - return _textFeilds; + return _textFields; } #pragma mark - layout contenview @@ -287,16 +287,16 @@ - (void)layoutContentViews [self addConstarintWithView:_textContentView topView:self leftView:self bottomView:nil rightView:self edageInset:UIEdgeInsetsMake(_contentViewSpace, _textLabelContentViewEdge, 0, -_textLabelContentViewEdge)]; - // textFeildContentView - _textFeildContentView.translatesAutoresizingMaskIntoConstraints = NO; - _textFeildTopConstraint = [self addConstarintWithTopView:_textContentView toBottomView:_textFeildContentView constarint:0]; + // textFieldContentView + _textFieldContentView.translatesAutoresizingMaskIntoConstraints = NO; + _textFieldTopConstraint = [self addConstarintWithTopView:_textContentView toBottomView:_textFieldContentView constarint:0]; - [self addConstarintWithView:_textFeildContentView topView:nil leftView:self bottomView:nil rightView:self edageInset:UIEdgeInsetsMake(0, _textFeildContentViewEdge, 0, -_textFeildContentViewEdge)]; + [self addConstarintWithView:_textFieldContentView topView:nil leftView:self bottomView:nil rightView:self edageInset:UIEdgeInsetsMake(0, _textFieldContentViewEdge, 0, -_textFieldContentViewEdge)]; // buttonContentView _buttonContentView.translatesAutoresizingMaskIntoConstraints = NO; - _buttonTopConstraint = [self addConstarintWithTopView:_textFeildContentView toBottomView:_buttonContentView constarint:0]; + _buttonTopConstraint = [self addConstarintWithTopView:_textFieldContentView toBottomView:_buttonContentView constarint:0]; [self addConstarintWithView:_buttonContentView topView:nil leftView:self bottomView:self rightView:self edageInset:UIEdgeInsetsMake(0, _buttonContentViewEdge, -_contentViewSpace, -_buttonContentViewEdge)]; } @@ -350,33 +350,33 @@ - (void)layoutButtons } } -- (void)layoutTextFeilds +- (void)layouttextFields { - UITextField *textFeild = _textFeilds.lastObject; + UITextField *textField = _textFields.lastObject; - if (_textFeilds.count == 1) { - // setup textFeildContentView - _textFeildContentView.backgroundColor = _textFieldBackgroudColor; - _textFeildContentView.layer.masksToBounds = YES; - _textFeildContentView.layer.cornerRadius = 4; - _textFeildContentView.layer.borderWidth = _textFeildorderWidth; - _textFeildContentView.layer.borderColor = _textFieldBorderColor.CGColor; - _textFeildTopConstraint.constant = -_contentViewSpace; - [_textFeildContentView addConstraintToView:textFeild edageInset:UIEdgeInsetsMake(_textFeildorderWidth, _textFeildEdge, -_textFeildorderWidth, -_textFeildEdge)]; - [textFeild addConstarintWidth:0 height:_textFeildHeight]; + if (_textFields.count == 1) { + // setup textFieldContentView + _textFieldContentView.backgroundColor = _textFieldBackgroudColor; + _textFieldContentView.layer.masksToBounds = YES; + _textFieldContentView.layer.cornerRadius = 4; + _textFieldContentView.layer.borderWidth = _textFieldorderWidth; + _textFieldContentView.layer.borderColor = _textFieldBorderColor.CGColor; + _textFieldTopConstraint.constant = -_contentViewSpace; + [_textFieldContentView addConstraintToView:textField edageInset:UIEdgeInsetsMake(_textFieldorderWidth, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; + [textField addConstarintWidth:0 height:_textFieldHeight]; }else { - // textFeild - UITextField *lastSecondTextFeild = _textFeilds[_textFeilds.count - 2]; - [_textFeildContentView removeConstraintWithView:lastSecondTextFeild attribte:NSLayoutAttributeBottom]; - [_textFeildContentView addConstarintWithTopView:lastSecondTextFeild toBottomView:textFeild constarint:_textFeildorderWidth]; - [_textFeildContentView addConstarintWithView:textFeild topView:nil leftView:_textFeildContentView bottomView:_textFeildContentView rightView:_textFeildContentView edageInset:UIEdgeInsetsMake(0, _textFeildEdge, -_textFeildorderWidth, -_textFeildEdge)]; - [_textFeildContentView addConstarintEqualWithView:textFeild widthToView:nil heightToView:lastSecondTextFeild]; + // textField + UITextField *lastSecondtextField = _textFields[_textFields.count - 2]; + [_textFieldContentView removeConstraintWithView:lastSecondtextField attribte:NSLayoutAttributeBottom]; + [_textFieldContentView addConstarintWithTopView:lastSecondtextField toBottomView:textField constarint:_textFieldorderWidth]; + [_textFieldContentView addConstarintWithView:textField topView:nil leftView:_textFieldContentView bottomView:_textFieldContentView rightView:_textFieldContentView edageInset:UIEdgeInsetsMake(0, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; + [_textFieldContentView addConstarintEqualWithView:textField widthToView:nil heightToView:lastSecondtextField]; // separateview - UIView *separateView = _textFeildSeparateViews[_textFeilds.count - 2]; - [_textFeildContentView addConstarintWithView:separateView topView:nil leftView:_textFeildContentView bottomView:nil rightView:_textFeildContentView edageInset:UIEdgeInsetsZero]; - [_textFeildContentView addConstarintWithTopView:separateView toBottomView:textFeild constarint:0]; - [separateView addConstarintWidth:0 height:_textFeildorderWidth]; + UIView *separateView = _textFieldSeparateViews[_textFields.count - 2]; + [_textFieldContentView addConstarintWithView:separateView topView:nil leftView:_textFieldContentView bottomView:nil rightView:_textFieldContentView edageInset:UIEdgeInsetsZero]; + [_textFieldContentView addConstarintWithTopView:separateView toBottomView:textField constarint:0]; + [separateView addConstarintWidth:0 height:_textFieldorderWidth]; } } From 73b6971c2fa8d9ab0c29fc6a1b3ac0f47cc5f344 Mon Sep 17 00:00:00 2001 From: yeBlueColor <122074809@qq.com> Date: Mon, 29 Aug 2016 09:41:42 +0800 Subject: [PATCH 20/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 70cea27..8092010 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ pod 'TYAlertController', '~> 1.1.6' @property (nonatomic, copy) void (^dismissComplete)(void); ``` -* show in controller (tow way) +* show in controller (tow way)(recommend) ```objc TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "]; From 712212a46536f825bf1ec8d14d668102bb896461 Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Mon, 29 Aug 2016 12:24:21 +0800 Subject: [PATCH 21/38] fixed spelling mistakes --- TYAlertControllerDemo/ShareView.m | 2 +- TYAlertControllerDemo/ShareView.xib | 18 +++--------------- .../TYAlertController/TYAlertView.h | 4 ++-- .../TYAlertController/TYAlertView.m | 6 +++--- TYAlertControllerDemo/ViewController.m | 8 ++++---- 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/TYAlertControllerDemo/ShareView.m b/TYAlertControllerDemo/ShareView.m index 65dc083..1b0eec4 100644 --- a/TYAlertControllerDemo/ShareView.m +++ b/TYAlertControllerDemo/ShareView.m @@ -11,7 +11,7 @@ @implementation ShareView -- (IBAction)cancleAction:(id)sender { +- (IBAction)cancelAction:(id)sender { // hide view,or dismiss controller [self hideView]; } diff --git a/TYAlertControllerDemo/ShareView.xib b/TYAlertControllerDemo/ShareView.xib index 99abd08..4843546 100644 --- a/TYAlertControllerDemo/ShareView.xib +++ b/TYAlertControllerDemo/ShareView.xib @@ -1,8 +1,7 @@ - + - - + @@ -13,7 +12,6 @@ - - - diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.h b/TYAlertControllerDemo/TYAlertController/TYAlertView.h index ecc6489..c76093e 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.h +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.h @@ -10,7 +10,7 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) { TYAlertActionStyleDefault, - TYAlertActionStyleCancle, + TYAlertActionStyleCancel, TYAlertActionStyleDestructive, }; @@ -50,7 +50,7 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) { @property (nonatomic, assign) CGFloat buttonCornerRadius; @property (nonatomic, strong) UIFont *buttonFont; @property (nonatomic, strong) UIColor *buttonDefaultBgColor; -@property (nonatomic, strong) UIColor *buttonCancleBgColor; +@property (nonatomic, strong) UIColor *buttonCancelBgColor; @property (nonatomic, strong) UIColor *buttonDestructiveBgColor; // textField custom diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index 2264951..38550cc 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -133,7 +133,7 @@ - (void)configureProperty _buttonCornerRadius = 4.0; _buttonFont = [UIFont fontWithName:@"HelveticaNeue" size:18];; _buttonDefaultBgColor = [UIColor colorWithRed:52/255.0 green:152/255.0 blue:219/255.0 alpha:1]; - _buttonCancleBgColor = [UIColor colorWithRed:127/255.0 green:140/255.0 blue:141/255.0 alpha:1]; + _buttonCancelBgColor = [UIColor colorWithRed:127/255.0 green:140/255.0 blue:141/255.0 alpha:1]; _buttonDestructiveBgColor = [UIColor colorWithRed:231/255.0 green:76/255.0 blue:60/255.0 alpha:1]; _textFieldHeight = ktextFieldHeight; @@ -154,8 +154,8 @@ - (UIColor *)buttonBgColorWithStyle:(TYAlertActionStyle)style switch (style) { case TYAlertActionStyleDefault: return _buttonDefaultBgColor; - case TYAlertActionStyleCancle: - return _buttonCancleBgColor; + case TYAlertActionStyleCancel: + return _buttonCancelBgColor; case TYAlertActionStyleDestructive: return _buttonDestructiveBgColor; diff --git a/TYAlertControllerDemo/ViewController.m b/TYAlertControllerDemo/ViewController.m index cc064ea..39182f6 100644 --- a/TYAlertControllerDemo/ViewController.m +++ b/TYAlertControllerDemo/ViewController.m @@ -31,7 +31,7 @@ - (IBAction)showAlertViewAction:(id)sender { TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "]; - [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) { + [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancel handler:^(TYAlertAction *action) { NSLog(@"%@",action.title); }]]; @@ -97,7 +97,7 @@ - (IBAction)showActionSheetAction:(id)sender { [alertView addAction:[TYAlertAction actionWithTitle:@"删除" style:TYAlertActionStyleDestructive handler:^(TYAlertAction *action) { NSLog(@"%@",action.title); }]]; - [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) { + [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancel handler:^(TYAlertAction *action) { NSLog(@"%@",action.title); }]]; @@ -120,7 +120,7 @@ - (IBAction)blurEffectAlertViewAction:(id)sender { - (IBAction)dropdwonAnimationAction:(id)sender { TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt dropdwon animation. "]; - [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) { + [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancel handler:^(TYAlertAction *action) { NSLog(@"%@",action.title); }]]; @@ -149,7 +149,7 @@ - (IBAction)showAlertViewInWindowAction:(id)sender { TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"A message should be a short, but it can support long message, hahahhahahahahhahahahahhaahahhahahahahahhahahahahhahahahahahhahahahahahhahahahhahahhahahahahh. (NSTextAlignmentCenter)"]; - [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) { + [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancel handler:^(TYAlertAction *action) { }]]; From 8899c5da117b8a77e5ace66bb5d193667a3924b7 Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Sat, 3 Sep 2016 20:28:24 +0800 Subject: [PATCH 22/38] update --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index b0217ba..cf8b2c8 100755 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 tany +Copyright (c) 2016 tany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From b88d59990d52cf0cdf2cab6f09c767b37267233a Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Sat, 3 Sep 2016 20:31:42 +0800 Subject: [PATCH 23/38] update 1.1.8 --- TYAlertController.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TYAlertController.podspec b/TYAlertController.podspec index e582a45..28f4632 100644 --- a/TYAlertController.podspec +++ b/TYAlertController.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| # 名称 使用的时候pod search [name] s.name = "TYAlertController" # 代码库的版本 -s.version = "1.1.6" +s.version = "1.1.8" # 简介 s.summary = "Powerful, Easy to use alertview or popup view on controller and window, support blur effects,custom view and animation." # 主页 From ba7b80cd7fb7a555430cea0ebe4770217a23db32 Mon Sep 17 00:00:00 2001 From: yeBlueColor <122074809@qq.com> Date: Sat, 3 Sep 2016 20:36:39 +0800 Subject: [PATCH 24/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8092010..a3ed755 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Powerful, Easy to use alertView or popupView on controller and window, support b ## CocoaPods ``` -pod 'TYAlertController', '~> 1.1.6' +pod 'TYAlertController' ``` ### ScreenShot From 3fc83aad01134ae509803c3ef53d4ab9d2c37ad8 Mon Sep 17 00:00:00 2001 From: yeBlueColor <122074809@qq.com> Date: Wed, 5 Oct 2016 08:28:50 +0800 Subject: [PATCH 25/38] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index a3ed755..b6417d6 100644 --- a/README.md +++ b/README.md @@ -84,5 +84,4 @@ TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message: ### Contact if you find bug,please pull reqeust me
-if you have good idea,contact me, Email:122074809@qq.com From bd911bbecacaace98bc3e091198a880461a89bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=B9=E5=87=AF=E5=B3=B0?= Date: Tue, 1 Nov 2016 09:41:07 +0800 Subject: [PATCH 26/38] Modify the wrong character. --- .../TYAlertController/TYAlertController.m | 14 ++-- .../TYAlertController/TYAlertView.m | 66 +++++++++---------- .../TYAlertController/TYShowAlertView.m | 10 +-- .../TYAlertController/UIView+TYAutoLayout.h | 18 ++--- .../TYAlertController/UIView+TYAutoLayout.m | 36 +++++----- 5 files changed, 72 insertions(+), 72 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.m b/TYAlertControllerDemo/TYAlertController/TYAlertController.m index b6bf870..40ab483 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.m @@ -166,7 +166,7 @@ - (void)addBackgroundView } _backgroundView.translatesAutoresizingMaskIntoConstraints = NO; [self.view insertSubview:_backgroundView atIndex:0]; - [self.view addConstraintToView:_backgroundView edageInset:UIEdgeInsetsZero]; + [self.view addConstraintToView:_backgroundView edgeInset:UIEdgeInsetsZero]; } - (void)setBackgroundView:(UIView *)backgroundView @@ -176,7 +176,7 @@ - (void)setBackgroundView:(UIView *)backgroundView } else if (_backgroundView != backgroundView) { backgroundView.translatesAutoresizingMaskIntoConstraints = NO; [self.view insertSubview:backgroundView aboveSubview:_backgroundView]; - [self.view addConstraintToView:backgroundView edageInset:UIEdgeInsetsZero]; + [self.view addConstraintToView:backgroundView edgeInset:UIEdgeInsetsZero]; backgroundView.alpha = 0; [UIView animateWithDuration:0.3 animations:^{ backgroundView.alpha = 1; @@ -245,7 +245,7 @@ - (void)configureAlertViewWidth { // width, height if (!CGSizeEqualToSize(_alertView.frame.size,CGSizeZero)) { - [_alertView addConstarintWidth:CGRectGetWidth(_alertView.frame) height:CGRectGetHeight(_alertView.frame)]; + [_alertView addConstraintWidth:CGRectGetWidth(_alertView.frame) height:CGRectGetHeight(_alertView.frame)]; }else { BOOL findAlertViewWidthConstraint = NO; @@ -257,7 +257,7 @@ - (void)configureAlertViewWidth } if (!findAlertViewWidthConstraint) { - [_alertView addConstarintWidth:CGRectGetWidth(self.view.frame)-2*_alertStyleEdging height:0]; + [_alertView addConstraintWidth:CGRectGetWidth(self.view.frame)-2*_alertStyleEdging height:0]; } } } @@ -267,7 +267,7 @@ - (void)configureAlertViewWidth - (void)layoutAlertStyleView { // center X - [self.view addConstraintCenterXToView:_alertView CenterYToView:nil]; + [self.view addConstraintCenterXToView:_alertView centerYToView:nil]; [self configureAlertViewWidth]; @@ -294,11 +294,11 @@ - (void)layoutActionSheetStyleView } // add edge constraint - [self.view addConstarintWithView:_alertView topView:nil leftView:self.view bottomView:self.view rightView:self.view edageInset:UIEdgeInsetsMake(0, _actionSheetStyleEdging, 0, -_actionSheetStyleEdging)]; + [self.view addConstraintWithView:_alertView topView:nil leftView:self.view bottomView:self.view rightView:self.view edgeInset:UIEdgeInsetsMake(0, _actionSheetStyleEdging, 0, -_actionSheetStyleEdging)]; if (CGRectGetHeight(_alertView.frame) > 0) { // height - [_alertView addConstarintWidth:0 height:CGRectGetHeight(_alertView.frame)]; + [_alertView addConstraintWidth:0 height:CGRectGetHeight(_alertView.frame)]; } } diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index 38550cc..d7194f0 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -279,26 +279,26 @@ - (void)layoutContentViews return; } if (_alertViewWidth) { - [self addConstarintWidth:_alertViewWidth height:0]; + [self addConstraintWidth:_alertViewWidth height:0]; } // textContentView _textContentView.translatesAutoresizingMaskIntoConstraints = NO; - [self addConstarintWithView:_textContentView topView:self leftView:self bottomView:nil rightView:self edageInset:UIEdgeInsetsMake(_contentViewSpace, _textLabelContentViewEdge, 0, -_textLabelContentViewEdge)]; + [self addConstraintWithView:_textContentView topView:self leftView:self bottomView:nil rightView:self edgeInset:UIEdgeInsetsMake(_contentViewSpace, _textLabelContentViewEdge, 0, -_textLabelContentViewEdge)]; // textFieldContentView _textFieldContentView.translatesAutoresizingMaskIntoConstraints = NO; - _textFieldTopConstraint = [self addConstarintWithTopView:_textContentView toBottomView:_textFieldContentView constarint:0]; + _textFieldTopConstraint = [self addConstraintWithTopView:_textContentView toBottomView:_textFieldContentView constant:0]; - [self addConstarintWithView:_textFieldContentView topView:nil leftView:self bottomView:nil rightView:self edageInset:UIEdgeInsetsMake(0, _textFieldContentViewEdge, 0, -_textFieldContentViewEdge)]; + [self addConstraintWithView:_textFieldContentView topView:nil leftView:self bottomView:nil rightView:self edgeInset:UIEdgeInsetsMake(0, _textFieldContentViewEdge, 0, -_textFieldContentViewEdge)]; // buttonContentView _buttonContentView.translatesAutoresizingMaskIntoConstraints = NO; - _buttonTopConstraint = [self addConstarintWithTopView:_textFieldContentView toBottomView:_buttonContentView constarint:0]; + _buttonTopConstraint = [self addConstraintWithTopView:_textFieldContentView toBottomView:_buttonContentView constant:0]; - [self addConstarintWithView:_buttonContentView topView:nil leftView:self bottomView:self rightView:self edageInset:UIEdgeInsetsMake(0, _buttonContentViewEdge, -_contentViewSpace, -_buttonContentViewEdge)]; + [self addConstraintWithView:_buttonContentView topView:nil leftView:self bottomView:self rightView:self edgeInset:UIEdgeInsetsMake(0, _buttonContentViewEdge, -_contentViewSpace, -_buttonContentViewEdge)]; } - (void)layoutTextLabels @@ -309,12 +309,12 @@ - (void)layoutTextLabels } // title _titleLable.translatesAutoresizingMaskIntoConstraints = NO; - [_textContentView addConstarintWithView:_titleLable topView:_textContentView leftView:_textContentView bottomView:nil rightView:_textContentView edageInset:UIEdgeInsetsZero]; + [_textContentView addConstraintWithView:_titleLable topView:_textContentView leftView:_textContentView bottomView:nil rightView:_textContentView edgeInset:UIEdgeInsetsZero]; // message _messageLabel.translatesAutoresizingMaskIntoConstraints = NO; - [_textContentView addConstarintWithTopView:_titleLable toBottomView:_messageLabel constarint:_textLabelSpace]; - [_textContentView addConstarintWithView:_messageLabel topView:nil leftView:_textContentView bottomView:_textContentView rightView:_textContentView edageInset:UIEdgeInsetsZero]; + [_textContentView addConstraintWithTopView:_titleLable toBottomView:_messageLabel constant:_textLabelSpace]; + [_textContentView addConstraintWithView:_messageLabel topView:nil leftView:_textContentView bottomView:_textContentView rightView:_textContentView edgeInset:UIEdgeInsetsZero]; } - (void)layoutButtons @@ -322,31 +322,31 @@ - (void)layoutButtons UIButton *button = _buttons.lastObject; if (_buttons.count == 1) { _buttonTopConstraint.constant = -_contentViewSpace; - [_buttonContentView addConstraintToView:button edageInset:UIEdgeInsetsZero]; - [button addConstarintWidth:0 height:_buttonHeight]; + [_buttonContentView addConstraintToView:button edgeInset:UIEdgeInsetsZero]; + [button addConstraintWidth:0 height:_buttonHeight]; }else if (_buttons.count == 2) { UIButton *firstButton = _buttons.firstObject; - [_buttonContentView removeConstraintWithView:firstButton attribte:NSLayoutAttributeRight]; - [_buttonContentView addConstarintWithView:button topView:_buttonContentView leftView:nil bottomView:nil rightView:_buttonContentView edageInset:UIEdgeInsetsZero]; - [_buttonContentView addConstarintWithLeftView:firstButton toRightView:button constarint:_buttonSpace]; - [_buttonContentView addConstarintEqualWithView:button widthToView:firstButton heightToView:firstButton]; + [_buttonContentView removeConstraintWithView:firstButton attribute:NSLayoutAttributeRight]; + [_buttonContentView addConstraintWithView:button topView:_buttonContentView leftView:nil bottomView:nil rightView:_buttonContentView edgeInset:UIEdgeInsetsZero]; + [_buttonContentView addConstraintWithLeftView:firstButton toRightView:button constant:_buttonSpace]; + [_buttonContentView addConstraintEqualWithView:button widthToView:firstButton heightToView:firstButton]; }else { if (_buttons.count == 3) { UIButton *firstBtn = _buttons[0]; UIButton *secondBtn = _buttons[1]; - [_buttonContentView removeConstraintWithView:firstBtn attribte:NSLayoutAttributeRight]; - [_buttonContentView removeConstraintWithView:firstBtn attribte:NSLayoutAttributeBottom]; - [_buttonContentView removeConstraintWithView:secondBtn attribte:NSLayoutAttributeTop]; - [_buttonContentView addConstarintWithView:firstBtn topView:nil leftView:nil bottomView:0 rightView:_buttonContentView edageInset:UIEdgeInsetsZero]; - [_buttonContentView addConstarintWithTopView:firstBtn toBottomView:secondBtn constarint:_buttonSpace]; + [_buttonContentView removeConstraintWithView:firstBtn attribute:NSLayoutAttributeRight]; + [_buttonContentView removeConstraintWithView:firstBtn attribute:NSLayoutAttributeBottom]; + [_buttonContentView removeConstraintWithView:secondBtn attribute:NSLayoutAttributeTop]; + [_buttonContentView addConstraintWithView:firstBtn topView:nil leftView:nil bottomView:0 rightView:_buttonContentView edgeInset:UIEdgeInsetsZero]; + [_buttonContentView addConstraintWithTopView:firstBtn toBottomView:secondBtn constant:_buttonSpace]; } UIButton *lastSecondBtn = _buttons[_buttons.count-2]; - [_buttonContentView removeConstraintWithView:lastSecondBtn attribte:NSLayoutAttributeBottom]; - [_buttonContentView addConstarintWithTopView:lastSecondBtn toBottomView:button constarint:_buttonSpace]; - [_buttonContentView addConstarintWithView:button topView:nil leftView:_buttonContentView bottomView:_buttonContentView rightView:_buttonContentView edageInset:UIEdgeInsetsZero]; - [_buttonContentView addConstarintEqualWithView:button widthToView:nil heightToView:lastSecondBtn]; + [_buttonContentView removeConstraintWithView:lastSecondBtn attribute:NSLayoutAttributeBottom]; + [_buttonContentView addConstraintWithTopView:lastSecondBtn toBottomView:button constant:_buttonSpace]; + [_buttonContentView addConstraintWithView:button topView:nil leftView:_buttonContentView bottomView:_buttonContentView rightView:_buttonContentView edgeInset:UIEdgeInsetsZero]; + [_buttonContentView addConstraintEqualWithView:button widthToView:nil heightToView:lastSecondBtn]; } } @@ -362,21 +362,21 @@ - (void)layouttextFields _textFieldContentView.layer.borderWidth = _textFieldorderWidth; _textFieldContentView.layer.borderColor = _textFieldBorderColor.CGColor; _textFieldTopConstraint.constant = -_contentViewSpace; - [_textFieldContentView addConstraintToView:textField edageInset:UIEdgeInsetsMake(_textFieldorderWidth, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; - [textField addConstarintWidth:0 height:_textFieldHeight]; + [_textFieldContentView addConstraintToView:textField edgeInset:UIEdgeInsetsMake(_textFieldorderWidth, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; + [textField addConstraintWidth:0 height:_textFieldHeight]; }else { // textField UITextField *lastSecondtextField = _textFields[_textFields.count - 2]; - [_textFieldContentView removeConstraintWithView:lastSecondtextField attribte:NSLayoutAttributeBottom]; - [_textFieldContentView addConstarintWithTopView:lastSecondtextField toBottomView:textField constarint:_textFieldorderWidth]; - [_textFieldContentView addConstarintWithView:textField topView:nil leftView:_textFieldContentView bottomView:_textFieldContentView rightView:_textFieldContentView edageInset:UIEdgeInsetsMake(0, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; - [_textFieldContentView addConstarintEqualWithView:textField widthToView:nil heightToView:lastSecondtextField]; + [_textFieldContentView removeConstraintWithView:lastSecondtextField attribute:NSLayoutAttributeBottom]; + [_textFieldContentView addConstraintWithTopView:lastSecondtextField toBottomView:textField constant:_textFieldorderWidth]; + [_textFieldContentView addConstraintWithView:textField topView:nil leftView:_textFieldContentView bottomView:_textFieldContentView rightView:_textFieldContentView edgeInset:UIEdgeInsetsMake(0, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; + [_textFieldContentView addConstraintEqualWithView:textField widthToView:nil heightToView:lastSecondtextField]; // separateview UIView *separateView = _textFieldSeparateViews[_textFields.count - 2]; - [_textFieldContentView addConstarintWithView:separateView topView:nil leftView:_textFieldContentView bottomView:nil rightView:_textFieldContentView edageInset:UIEdgeInsetsZero]; - [_textFieldContentView addConstarintWithTopView:separateView toBottomView:textField constarint:0]; - [separateView addConstarintWidth:0 height:_textFieldorderWidth]; + [_textFieldContentView addConstraintWithView:separateView topView:nil leftView:_textFieldContentView bottomView:nil rightView:_textFieldContentView edgeInset:UIEdgeInsetsZero]; + [_textFieldContentView addConstraintWithTopView:separateView toBottomView:textField constant:0]; + [separateView addConstraintWidth:0 height:_textFieldorderWidth]; } } diff --git a/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m b/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m index 92214af..a45c5e9 100644 --- a/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m @@ -84,7 +84,7 @@ - (void)addBackgroundView } [self insertSubview:_backgroundView atIndex:0]; _backgroundView.translatesAutoresizingMaskIntoConstraints = NO; - [self addConstraintToView:_backgroundView edageInset:UIEdgeInsetsZero]; + [self addConstraintToView:_backgroundView edgeInset:UIEdgeInsetsZero]; } - (void)setBackgroundView:(UIView *)backgroundView @@ -106,7 +106,7 @@ - (void)didMoveToSuperview { if (self.superview) { self.translatesAutoresizingMaskIntoConstraints = NO; - [self.superview addConstraintToView:self edageInset:UIEdgeInsetsZero]; + [self.superview addConstraintToView:self edgeInset:UIEdgeInsetsZero]; [self layoutAlertView]; } } @@ -115,11 +115,11 @@ - (void)layoutAlertView { _alertView.translatesAutoresizingMaskIntoConstraints = NO; // center X - [self addConstraintCenterXToView:_alertView CenterYToView:nil]; + [self addConstraintCenterXToView:_alertView centerYToView:nil]; // width, height if (!CGSizeEqualToSize(_alertView.frame.size,CGSizeZero)) { - [_alertView addConstarintWidth:CGRectGetWidth(_alertView.frame) height:CGRectGetHeight(_alertView.frame)]; + [_alertView addConstraintWidth:CGRectGetWidth(_alertView.frame) height:CGRectGetHeight(_alertView.frame)]; }else { BOOL findAlertViewWidthConstraint = NO; @@ -131,7 +131,7 @@ - (void)layoutAlertView } if (!findAlertViewWidthConstraint) { - [_alertView addConstarintWidth:CGRectGetWidth(self.superview.frame)-2*_alertViewEdging height:0]; + [_alertView addConstraintWidth:CGRectGetWidth(self.superview.frame)-2*_alertViewEdging height:0]; } } diff --git a/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.h b/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.h index fbe74f8..0551f61 100644 --- a/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.h +++ b/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.h @@ -10,26 +10,26 @@ @interface UIView (TYAutoLayout) -- (void)addConstraintToView:(UIView *)view edageInset:(UIEdgeInsets)edageInset; +- (void)addConstraintToView:(UIView *)view edgeInset:(UIEdgeInsets)edgeInset; -- (void)addConstarintWithView:(UIView *)view topView:(UIView *)topView leftView:(UIView *)leftView - bottomView:(UIView *)bottomView rightView:(UIView *)rightView edageInset:(UIEdgeInsets)edageInset; +- (void)addConstraintWithView:(UIView *)view topView:(UIView *)topView leftView:(UIView *)leftView + bottomView:(UIView *)bottomView rightView:(UIView *)rightView edgeInset:(UIEdgeInsets)edgeInset; -- (void)addConstarintWithLeftView:(UIView *)leftView toRightView:(UIView *)rightView constarint:(CGFloat)constarint; +- (void)addConstraintWithLeftView:(UIView *)leftView toRightView:(UIView *)rightView constant:(CGFloat)constant; -- (NSLayoutConstraint *)addConstarintWithTopView:(UIView *)topView toBottomView:(UIView *)bottomView constarint:(CGFloat)constarint; +- (NSLayoutConstraint *)addConstraintWithTopView:(UIView *)topView toBottomView:(UIView *)bottomView constant:(CGFloat)constant; -- (void)addConstarintWidth:(CGFloat)width height:(CGFloat)height; +- (void)addConstraintWidth:(CGFloat)width height:(CGFloat)height; -- (void)addConstarintEqualWithView:(UIView *)view widthToView:(UIView *)wView heightToView:(UIView *)hView; +- (void)addConstraintEqualWithView:(UIView *)view widthToView:(UIView *)wView heightToView:(UIView *)hView; - (NSLayoutConstraint *)addConstraintCenterYToView:(UIView *)yView constant:(CGFloat)constant; -- (void)addConstraintCenterXToView:(UIView *)xView CenterYToView:(UIView *)yView; +- (void)addConstraintCenterXToView:(UIView *)xView centerYToView:(UIView *)yView; - (void)removeConstraintWithAttribte:(NSLayoutAttribute)attr; -- (void)removeConstraintWithView:(UIView *)view attribte:(NSLayoutAttribute)attr; +- (void)removeConstraintWithView:(UIView *)view attribute:(NSLayoutAttribute)attr; - (void)removeAllConstraints; diff --git a/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.m b/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.m index 329125b..e0c0316 100644 --- a/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.m +++ b/TYAlertControllerDemo/TYAlertController/UIView+TYAutoLayout.m @@ -10,44 +10,44 @@ @implementation UIView (TYAutoLayout) -- (void)addConstraintToView:(UIView *)view edageInset:(UIEdgeInsets)edageInset +- (void)addConstraintToView:(UIView *)view edgeInset:(UIEdgeInsets)edgeInset { - [self addConstarintWithView:view topView:self leftView:self bottomView:self rightView:self edageInset:edageInset]; + [self addConstraintWithView:view topView:self leftView:self bottomView:self rightView:self edgeInset:edgeInset]; } -- (void)addConstarintWithView:(UIView *)view topView:(UIView *)topView leftView:(UIView *)leftView - bottomView:(UIView *)bottomView rightView:(UIView *)rightView edageInset:(UIEdgeInsets)edageInset +- (void)addConstraintWithView:(UIView *)view topView:(UIView *)topView leftView:(UIView *)leftView + bottomView:(UIView *)bottomView rightView:(UIView *)rightView edgeInset:(UIEdgeInsets)edgeInset { if (topView) { - [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:topView attribute:NSLayoutAttributeTop multiplier:1 constant:edageInset.top]]; + [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:topView attribute:NSLayoutAttributeTop multiplier:1 constant:edgeInset.top]]; } if (leftView) { - [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:leftView attribute:NSLayoutAttributeLeft multiplier:1 constant:edageInset.left]]; + [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:leftView attribute:NSLayoutAttributeLeft multiplier:1 constant:edgeInset.left]]; } if (rightView) { - [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:rightView attribute:NSLayoutAttributeRight multiplier:1 constant:edageInset.right]]; + [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:rightView attribute:NSLayoutAttributeRight multiplier:1 constant:edgeInset.right]]; } if (bottomView) { - [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bottomView attribute:NSLayoutAttributeBottom multiplier:1 constant:edageInset.bottom]]; + [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bottomView attribute:NSLayoutAttributeBottom multiplier:1 constant:edgeInset.bottom]]; } } -- (void)addConstarintWithLeftView:(UIView *)leftView toRightView:(UIView *)rightView constarint:(CGFloat)constarint +- (void)addConstraintWithLeftView:(UIView *)leftView toRightView:(UIView *)rightView constant:(CGFloat)constant { - [self addConstraint:[NSLayoutConstraint constraintWithItem:leftView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:rightView attribute:NSLayoutAttributeLeft multiplier:1 constant:-constarint]]; + [self addConstraint:[NSLayoutConstraint constraintWithItem:leftView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:rightView attribute:NSLayoutAttributeLeft multiplier:1 constant:-constant]]; } -- (NSLayoutConstraint *)addConstarintWithTopView:(UIView *)topView toBottomView:(UIView *)bottomView constarint:(CGFloat)constarint +- (NSLayoutConstraint *)addConstraintWithTopView:(UIView *)topView toBottomView:(UIView *)bottomView constant:(CGFloat)constant { - NSLayoutConstraint *topButtomConstraint =[NSLayoutConstraint constraintWithItem:topView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bottomView attribute:NSLayoutAttributeTop multiplier:1 constant:-constarint]; - [self addConstraint:topButtomConstraint]; - return topButtomConstraint; + NSLayoutConstraint *topBottomConstraint =[NSLayoutConstraint constraintWithItem:topView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bottomView attribute:NSLayoutAttributeTop multiplier:1 constant:-constant]; + [self addConstraint:topBottomConstraint]; + return topBottomConstraint; } -- (void)addConstarintWidth:(CGFloat)width height:(CGFloat)height +- (void)addConstraintWidth:(CGFloat)width height:(CGFloat)height { if (width > 0) { [self addConstraint:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1 constant:width]]; @@ -58,7 +58,7 @@ - (void)addConstarintWidth:(CGFloat)width height:(CGFloat)height } } -- (void)addConstarintEqualWithView:(UIView *)view widthToView:(UIView *)wView heightToView:(UIView *)hView +- (void)addConstraintEqualWithView:(UIView *)view widthToView:(UIView *)wView heightToView:(UIView *)hView { if (wView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:wView attribute:NSLayoutAttributeWidth multiplier:1 constant:0]]; @@ -69,7 +69,7 @@ - (void)addConstarintEqualWithView:(UIView *)view widthToView:(UIView *)wView he } } -- (void)addConstraintCenterXToView:(UIView *)xView CenterYToView:(UIView *)yView +- (void)addConstraintCenterXToView:(UIView *)xView centerYToView:(UIView *)yView { if (xView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:xView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]]; @@ -100,7 +100,7 @@ - (void)removeConstraintWithAttribte:(NSLayoutAttribute)attr } } -- (void)removeConstraintWithView:(UIView *)view attribte:(NSLayoutAttribute)attr +- (void)removeConstraintWithView:(UIView *)view attribute:(NSLayoutAttribute)attr { for (NSLayoutConstraint *constraint in self.constraints) { if (constraint.firstAttribute == attr && constraint.firstItem == view) { From ee15be3b10ffb68a2dba0200eb69f2066da2970e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=B9=E5=87=AF=E5=B3=B0?= Date: Wed, 2 Nov 2016 13:45:57 +0800 Subject: [PATCH 27/38] Modify the wrong character --- .../TYAlertController/TYAlertView.h | 2 +- .../TYAlertController/TYAlertView.m | 42 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.h b/TYAlertControllerDemo/TYAlertController/TYAlertView.h index c76093e..a3fcc9e 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.h +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.h @@ -59,7 +59,7 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) { @property (nonatomic, strong) UIFont *textFieldFont; @property (nonatomic, assign) CGFloat textFieldHeight; @property (nonatomic, assign) CGFloat textFieldEdge; -@property (nonatomic, assign) CGFloat textFieldorderWidth; +@property (nonatomic, assign) CGFloat textFieldBorderWidth; @property (nonatomic, assign) CGFloat textFieldContentViewEdge; diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index d7194f0..5b1b096 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -76,10 +76,10 @@ @interface TYAlertView () #define kButtonSpace 6 #define KButtonHeight 44 -#define ktextFieldOffset 10000 -#define ktextFieldHeight 29 -#define ktextFieldEdge 8 -#define KtextFieldBorderWidth 0.5 +#define kTextFieldOffset 10000 +#define kTextFieldHeight 29 +#define kTextFieldEdge 8 +#define KTextFieldBorderWidth 0.5 @implementation TYAlertView @@ -131,14 +131,14 @@ - (void)configureProperty _buttonSpace = kButtonSpace; _buttonContentViewEdge = kContentViewEdge; _buttonCornerRadius = 4.0; - _buttonFont = [UIFont fontWithName:@"HelveticaNeue" size:18];; + _buttonFont = [UIFont fontWithName:@"HelveticaNeue" size:18]; _buttonDefaultBgColor = [UIColor colorWithRed:52/255.0 green:152/255.0 blue:219/255.0 alpha:1]; _buttonCancelBgColor = [UIColor colorWithRed:127/255.0 green:140/255.0 blue:141/255.0 alpha:1]; _buttonDestructiveBgColor = [UIColor colorWithRed:231/255.0 green:76/255.0 blue:60/255.0 alpha:1]; - _textFieldHeight = ktextFieldHeight; - _textFieldEdge = ktextFieldEdge; - _textFieldorderWidth = KtextFieldBorderWidth; + _textFieldHeight = kTextFieldHeight; + _textFieldEdge = kTextFieldEdge; + _textFieldBorderWidth = KTextFieldBorderWidth; _textFieldContentViewEdge = kContentViewEdge; _textFieldBorderColor = [UIColor colorWithRed:203/255.0 green:203/255.0 blue:203/255.0 alpha:1]; @@ -240,7 +240,7 @@ - (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))c } UITextField *textField = [[UITextField alloc]init]; - textField.tag = ktextFieldOffset + _textFields.count; + textField.tag = kTextFieldOffset + _textFields.count; textField.font = _textFieldFont; textField.translatesAutoresizingMaskIntoConstraints = NO; @@ -262,7 +262,7 @@ - (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))c [_textFieldSeparateViews addObject:separateView]; } - [self layouttextFields]; + [self layoutTextFields]; } - (NSArray *)textFieldArray @@ -337,12 +337,12 @@ - (void)layoutButtons [_buttonContentView removeConstraintWithView:firstBtn attribute:NSLayoutAttributeRight]; [_buttonContentView removeConstraintWithView:firstBtn attribute:NSLayoutAttributeBottom]; [_buttonContentView removeConstraintWithView:secondBtn attribute:NSLayoutAttributeTop]; - [_buttonContentView addConstraintWithView:firstBtn topView:nil leftView:nil bottomView:0 rightView:_buttonContentView edgeInset:UIEdgeInsetsZero]; + [_buttonContentView addConstraintWithView:firstBtn topView:nil leftView:nil bottomView:nil rightView:_buttonContentView edgeInset:UIEdgeInsetsZero]; [_buttonContentView addConstraintWithTopView:firstBtn toBottomView:secondBtn constant:_buttonSpace]; } - UIButton *lastSecondBtn = _buttons[_buttons.count-2]; + UIButton *lastSecondBtn = _buttons[_buttons.count - 2]; [_buttonContentView removeConstraintWithView:lastSecondBtn attribute:NSLayoutAttributeBottom]; [_buttonContentView addConstraintWithTopView:lastSecondBtn toBottomView:button constant:_buttonSpace]; [_buttonContentView addConstraintWithView:button topView:nil leftView:_buttonContentView bottomView:_buttonContentView rightView:_buttonContentView edgeInset:UIEdgeInsetsZero]; @@ -350,7 +350,7 @@ - (void)layoutButtons } } -- (void)layouttextFields +- (void)layoutTextFields { UITextField *textField = _textFields.lastObject; @@ -359,24 +359,24 @@ - (void)layouttextFields _textFieldContentView.backgroundColor = _textFieldBackgroudColor; _textFieldContentView.layer.masksToBounds = YES; _textFieldContentView.layer.cornerRadius = 4; - _textFieldContentView.layer.borderWidth = _textFieldorderWidth; + _textFieldContentView.layer.borderWidth = _textFieldBorderWidth; _textFieldContentView.layer.borderColor = _textFieldBorderColor.CGColor; _textFieldTopConstraint.constant = -_contentViewSpace; - [_textFieldContentView addConstraintToView:textField edgeInset:UIEdgeInsetsMake(_textFieldorderWidth, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; + [_textFieldContentView addConstraintToView:textField edgeInset:UIEdgeInsetsMake(_textFieldBorderWidth, _textFieldEdge, -_textFieldBorderWidth, -_textFieldEdge)]; [textField addConstraintWidth:0 height:_textFieldHeight]; }else { // textField - UITextField *lastSecondtextField = _textFields[_textFields.count - 2]; - [_textFieldContentView removeConstraintWithView:lastSecondtextField attribute:NSLayoutAttributeBottom]; - [_textFieldContentView addConstraintWithTopView:lastSecondtextField toBottomView:textField constant:_textFieldorderWidth]; - [_textFieldContentView addConstraintWithView:textField topView:nil leftView:_textFieldContentView bottomView:_textFieldContentView rightView:_textFieldContentView edgeInset:UIEdgeInsetsMake(0, _textFieldEdge, -_textFieldorderWidth, -_textFieldEdge)]; - [_textFieldContentView addConstraintEqualWithView:textField widthToView:nil heightToView:lastSecondtextField]; + UITextField *lastSecondTextField = _textFields[_textFields.count - 2]; + [_textFieldContentView removeConstraintWithView:lastSecondTextField attribute:NSLayoutAttributeBottom]; + [_textFieldContentView addConstraintWithTopView:lastSecondTextField toBottomView:textField constant:_textFieldBorderWidth]; + [_textFieldContentView addConstraintWithView:textField topView:nil leftView:_textFieldContentView bottomView:_textFieldContentView rightView:_textFieldContentView edgeInset:UIEdgeInsetsMake(0, _textFieldEdge, -_textFieldBorderWidth, -_textFieldEdge)]; + [_textFieldContentView addConstraintEqualWithView:textField widthToView:nil heightToView:lastSecondTextField]; // separateview UIView *separateView = _textFieldSeparateViews[_textFields.count - 2]; [_textFieldContentView addConstraintWithView:separateView topView:nil leftView:_textFieldContentView bottomView:nil rightView:_textFieldContentView edgeInset:UIEdgeInsetsZero]; [_textFieldContentView addConstraintWithTopView:separateView toBottomView:textField constant:0]; - [separateView addConstraintWidth:0 height:_textFieldorderWidth]; + [separateView addConstraintWidth:0 height:_textFieldBorderWidth]; } } From a157743a0cc8044c8975d9c790c0bbf49c77b958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=B9=E5=87=AF=E5=B3=B0?= Date: Thu, 3 Nov 2016 08:51:14 +0800 Subject: [PATCH 28/38] Modify the wrong character --- TYAlertControllerDemo/TYAlertController/TYAlertController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.m b/TYAlertControllerDemo/TYAlertController/TYAlertController.m index 40ab483..fa4c73f 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.m @@ -314,7 +314,7 @@ - (void)singleTap:(UITapGestureRecognizer *)sender [self dismissViewControllerAnimated:YES]; } -#pragma mark - notifycation +#pragma mark - notification - (void)keyboardWillShow:(NSNotification*)notification{ CGRect keyboardRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; From c818cbbd0fbe8641cb8ad35bcdd54e0d8e69fa0a Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Sat, 5 Nov 2016 09:37:32 +0800 Subject: [PATCH 29/38] save --- .../AppIcon.appiconset/Contents.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/TYAlertControllerDemo/Images.xcassets/AppIcon.appiconset/Contents.json b/TYAlertControllerDemo/Images.xcassets/AppIcon.appiconset/Contents.json index 36d2c80..1d060ed 100644 --- a/TYAlertControllerDemo/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/TYAlertControllerDemo/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -59,6 +79,11 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" } ], "info" : { From 6d4b1673404cbda92b00ffa8b810753dba273858 Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Sat, 5 Nov 2016 09:41:21 +0800 Subject: [PATCH 30/38] add buttonContentViewEdge; --- TYAlertControllerDemo/TYAlertController/TYAlertView.h | 1 + TYAlertControllerDemo/TYAlertController/TYAlertView.m | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.h b/TYAlertControllerDemo/TYAlertController/TYAlertView.h index c76093e..6cf8582 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.h +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.h @@ -47,6 +47,7 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) { @property (nonatomic, assign) CGFloat buttonHeight; @property (nonatomic, assign) CGFloat buttonSpace; @property (nonatomic, assign) CGFloat buttonContentViewEdge; +@property (nonatomic, assign) CGFloat buttonContentViewTop; @property (nonatomic, assign) CGFloat buttonCornerRadius; @property (nonatomic, strong) UIFont *buttonFont; @property (nonatomic, strong) UIColor *buttonDefaultBgColor; diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index d7194f0..d8f7d5c 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -130,6 +130,7 @@ - (void)configureProperty _buttonHeight = KButtonHeight; _buttonSpace = kButtonSpace; _buttonContentViewEdge = kContentViewEdge; + _buttonContentViewTop = 0; _buttonCornerRadius = 4.0; _buttonFont = [UIFont fontWithName:@"HelveticaNeue" size:18];; _buttonDefaultBgColor = [UIColor colorWithRed:52/255.0 green:152/255.0 blue:219/255.0 alpha:1]; @@ -296,7 +297,7 @@ - (void)layoutContentViews // buttonContentView _buttonContentView.translatesAutoresizingMaskIntoConstraints = NO; - _buttonTopConstraint = [self addConstraintWithTopView:_textFieldContentView toBottomView:_buttonContentView constant:0]; + _buttonTopConstraint = [self addConstraintWithTopView:_textFieldContentView toBottomView:_buttonContentView constant:_buttonContentViewTop]; [self addConstraintWithView:_buttonContentView topView:nil leftView:self bottomView:self rightView:self edgeInset:UIEdgeInsetsMake(0, _buttonContentViewEdge, -_contentViewSpace, -_buttonContentViewEdge)]; } From e979e8f6730b26797fc0d3ddf1749e5314d775d8 Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Sat, 5 Nov 2016 09:52:56 +0800 Subject: [PATCH 31/38] add buttonContentViewTop --- TYAlertControllerDemo/TYAlertController/TYAlertView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index d8f7d5c..a46791e 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -130,7 +130,7 @@ - (void)configureProperty _buttonHeight = KButtonHeight; _buttonSpace = kButtonSpace; _buttonContentViewEdge = kContentViewEdge; - _buttonContentViewTop = 0; + _buttonContentViewTop = kContentViewSpace; _buttonCornerRadius = 4.0; _buttonFont = [UIFont fontWithName:@"HelveticaNeue" size:18];; _buttonDefaultBgColor = [UIColor colorWithRed:52/255.0 green:152/255.0 blue:219/255.0 alpha:1]; @@ -322,7 +322,7 @@ - (void)layoutButtons { UIButton *button = _buttons.lastObject; if (_buttons.count == 1) { - _buttonTopConstraint.constant = -_contentViewSpace; + _buttonTopConstraint.constant = -_buttonContentViewTop; [_buttonContentView addConstraintToView:button edgeInset:UIEdgeInsetsZero]; [button addConstraintWidth:0 height:_buttonHeight]; }else if (_buttons.count == 2) { From a8e182d5a23c2c3a69f2692b5aed32686a981365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=B9=E5=87=AF=E5=B3=B0?= Date: Mon, 21 Nov 2016 13:52:07 +0800 Subject: [PATCH 32/38] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E5=A4=8D=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E7=83=AD=E7=82=B9=E6=97=B6=E9=94=AE=E7=9B=98=E9=81=AE?= =?UTF-8?q?=E6=8C=A1=E9=97=AE=E9=A2=98=202=E3=80=81=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E8=8E=B7=E5=8F=96=E7=84=A6=E7=82=B9?= =?UTF-8?q?=E6=97=B6=E9=87=8D=E5=A4=8D=E5=88=B7=E6=96=B0=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TYAlertController/TYAlertController.m | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.m b/TYAlertControllerDemo/TYAlertController/TYAlertController.m index fa4c73f..48785a7 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.m @@ -316,14 +316,24 @@ - (void)singleTap:(UITapGestureRecognizer *)sender #pragma mark - notification -- (void)keyboardWillShow:(NSNotification*)notification{ +- (void)keyboardWillShow:(NSNotification*)notification +{ CGRect keyboardRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGFloat alertViewBottomEdge = (CGRectGetHeight(self.view.frame) - CGRectGetHeight(_alertView.frame))/2 - _alertViewCenterYOffset; + + //当开启热点时,向下偏移20px + //修复键盘遮挡问题 + CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height; CGFloat differ = CGRectGetHeight(keyboardRect) - alertViewBottomEdge; + + //修复:输入框获取焦点时,会重复刷新,导致输入框文章偏移一下 + if (_alertViewCenterYConstraint.constant == -differ -statusBarHeight) { + return; + } if (differ >= 0) { - _alertViewCenterYConstraint.constant = _alertViewCenterYOffset - differ; + _alertViewCenterYConstraint.constant = _alertViewCenterYOffset - differ - statusBarHeight; [UIView animateWithDuration:0.25 animations:^{ [self.view layoutIfNeeded]; }]; @@ -331,8 +341,8 @@ - (void)keyboardWillShow:(NSNotification*)notification{ } -- (void)keyboardWillHide:(NSNotification*)notification{ - +- (void)keyboardWillHide:(NSNotification*)notification +{ _alertViewCenterYConstraint.constant = _alertViewCenterYOffset; [UIView animateWithDuration:0.25 animations:^{ [self.view layoutIfNeeded]; @@ -348,7 +358,6 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; - //NSLog(@"%@ dealloc",NSStringFromClass([self class])); } @end From fe0d50247ba0771ef1611018da81422dfdb13422 Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Fri, 17 Feb 2017 16:55:59 +0800 Subject: [PATCH 33/38] add alertViewclickedAutoHide --- TYAlertControllerDemo/TYAlertController/TYAlertView.h | 2 ++ TYAlertControllerDemo/TYAlertController/TYAlertView.m | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.h b/TYAlertControllerDemo/TYAlertController/TYAlertView.h index 1b1ded7..793fcaa 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.h +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.h @@ -63,6 +63,8 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) { @property (nonatomic, assign) CGFloat textFieldBorderWidth; @property (nonatomic, assign) CGFloat textFieldContentViewEdge; +@property (nonatomic, assign) BOOL clickedAutoHide; + + (instancetype)alertViewWithTitle:(NSString *)title message:(NSString *)message; diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index a074cd8..36f9976 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -120,6 +120,7 @@ + (instancetype)alertViewWithTitle:(NSString *)title message:(NSString *)message - (void)configureProperty { + _clickedAutoHide = YES; self.backgroundColor = [UIColor whiteColor]; _alertViewWidth = kAlertViewWidth; _contentViewSpace = kContentViewSpace; @@ -387,7 +388,9 @@ - (void)actionButtonClicked:(UIButton *)button { TYAlertAction *action = _actions[button.tag - kButtonTagOffset]; - [self hideView]; + if (_clickedAutoHide) { + [self hideView]; + } if (action.handler) { action.handler(action); From f811f1b56d99ca04f7a669fa6e1a3a6af45096eb Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Fri, 17 Feb 2017 16:59:03 +0800 Subject: [PATCH 34/38] fixed super init --- TYAlertControllerDemo/TYAlertController/TYAlertView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertView.m b/TYAlertControllerDemo/TYAlertController/TYAlertView.m index 36f9976..9eabc29 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertView.m @@ -102,7 +102,7 @@ - (instancetype)initWithFrame:(CGRect)frame - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message { - if (self = [super init]) { + if (self = [self init]) { _titleLable.text = title; _messageLabel.text = message; From 7e94f611a6d2eb42327e727825715f77cb48ba89 Mon Sep 17 00:00:00 2001 From: Aiden Rao Date: Thu, 11 May 2017 17:28:29 +0800 Subject: [PATCH 35/38] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AA=20bu?= =?UTF-8?q?g=EF=BC=8C=E5=9C=A8=E6=B7=BB=E5=8A=A0=E6=AF=9B=E7=8E=BB?= =?UTF-8?q?=E7=92=83=E8=83=8C=E6=99=AF=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E7=9A=84=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TYAlertControllerDemo/TYAlertController/TYAlertController.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController.m b/TYAlertControllerDemo/TYAlertController/TYAlertController.m index 48785a7..8493455 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController.m @@ -191,7 +191,8 @@ - (void)setBackgroundView:(UIView *)backgroundView - (void)addSingleTapGesture { self.view.userInteractionEnabled = YES; - + _backgroundView.userInteractionEnabled = YES; + UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)]; singleTap.enabled = _backgoundTapDismissEnable; From db70840f0f680071bd0768ee253117bfae3f3b99 Mon Sep 17 00:00:00 2001 From: Candy <81990319@qq.com> Date: Thu, 3 Aug 2017 12:49:22 +0800 Subject: [PATCH 36/38] fix transitionAnimation crash bug --- .../TYAlertController/TYAlertController+TransitionAnimate.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TYAlertControllerDemo/TYAlertController/TYAlertController+TransitionAnimate.m b/TYAlertControllerDemo/TYAlertController/TYAlertController+TransitionAnimate.m index 031590c..9c509f4 100644 --- a/TYAlertControllerDemo/TYAlertController/TYAlertController+TransitionAnimate.m +++ b/TYAlertControllerDemo/TYAlertController/TYAlertController+TransitionAnimate.m @@ -25,7 +25,7 @@ @implementation TYAlertController (TransitionAnimate) case TYAlertTransitionAnimationDropDown: return [TYAlertDropDownAnimation alertAnimationIsPresenting:YES]; case TYAlertTransitionAnimationCustom: - return [self.class alertAnimationIsPresenting:YES preferredStyle:self.preferredStyle]; + return [self.transitionAnimationClass alertAnimationIsPresenting:YES preferredStyle:self.preferredStyle]; default: return nil; } @@ -41,7 +41,7 @@ @implementation TYAlertController (TransitionAnimate) case TYAlertTransitionAnimationDropDown: return [TYAlertDropDownAnimation alertAnimationIsPresenting:NO]; case TYAlertTransitionAnimationCustom: - return [self.class alertAnimationIsPresenting:NO preferredStyle:self.preferredStyle]; + return [self.transitionAnimationClass alertAnimationIsPresenting:NO preferredStyle:self.preferredStyle]; default: return nil; } From 073a36d5cdc4a27305c1406a9da69c46be9bd1ae Mon Sep 17 00:00:00 2001 From: tanyang <122074809@qq.com> Date: Fri, 10 Nov 2017 23:29:45 +0800 Subject: [PATCH 37/38] add v1.2.0 --- TYAlertController.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TYAlertController.podspec b/TYAlertController.podspec index 28f4632..d6a8b29 100644 --- a/TYAlertController.podspec +++ b/TYAlertController.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| # 名称 使用的时候pod search [name] s.name = "TYAlertController" # 代码库的版本 -s.version = "1.1.8" +s.version = "1.2.0" # 简介 s.summary = "Powerful, Easy to use alertview or popup view on controller and window, support blur effects,custom view and animation." # 主页 @@ -21,4 +21,4 @@ s.source_files = "TYAlertControllerDemo/TYAlertController/**/*.{h,m}" # s.resources = "**/*/*.bundle" # 框架是否使用的ARC s.requires_arc = true -end \ No newline at end of file +end From 808a87949864e64a0152df024b3bf5041f8601a4 Mon Sep 17 00:00:00 2001 From: yeBlueColor <122074809@qq.com> Date: Sun, 29 Apr 2018 09:01:39 +0800 Subject: [PATCH 38/38] Fixed kCurrentWindow --- .../UserInterfaceState.xcuserstate | Bin 0 -> 19529 bytes .../TYAlertController/TYShowAlertView.m | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 TYAlertControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/tanyang.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/TYAlertControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/tanyang.xcuserdatad/UserInterfaceState.xcuserstate b/TYAlertControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/tanyang.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..a0c96872aba17d3f45d9c0bae5af0d7491028183 GIT binary patch literal 19529 zcmd^ncYKr87x%r-^EBy9(#eLDmZp>@O`0Z6XOb=`qm(WvtAsSPfi@`_KpAp_fC37L z2nY@+TND&!iUSaFu%}y`h#-Q13zYZVJWU6nKi|*i{qJo)Np9{u_uO;OIrpCL)3FV8 zR;Np;JcBS|5Q{kEhXmXNu5MWDB#XmowcCcp+Q*K!m|f1wSd+tCYlZBxSeLya4B@$} zw}s+NQqP^8L3eU(x5Dqjr1rV4L}1?2^x*6&=_PwV^J-# zA{&~58qriV4NXTg5JB_N0`wSKjGjbG(F(L0twEd73up^^5xs=Aqu0=G^d>rh4x+Q@ z96FCaLLZ|~(5L7#^f~$teUC1pAJJuW1^tAsqMPUz`V|M_ARLTCun3E>1c%}<9F8M! zB#y!za7Ww|$KY7p3(IjT*5Ndqjx%s3&cc0hKU|3W<1$>1EAUWk!eg-+*Wd|w8lH}4 z;D_)`Oz>>{2!0gL!;j-9@p8NpKaaQJm+>ojJAM_vhIioIcn>~~PvDdI6h4j5;IsG~ zK94`bU*K=>PxvbS9sj}jF#<-&_%i`aC#Eygh3U$4W4bdvm|jdAlgP-KR7S_7F?uGK z$z%F6#mq3Kk{Qm7V``XM#>$LmCNOnOJ=4e##>32E<}!~k3z+rH24*9(iP_A&z-(b& zWL{#nGTWH#%noKJvxnKs9AFMI?=T-QCzwx|PnqwS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zJDGl&{+U6UqRi0D@JwlDpG;L|N@i+idS+2(ab{)al*}2K&tz`Sd@*xt<|~Vj06yKK->rX3zh8e)e@K5se_Vf3e@1^!|E2zl{wMua z{Wbkx24r9ieg=O-pdsAQ(a^=v-5@o{4Jih#L1#!e7!7%b0z;u;fT7$l+AzW3Ft`kp z3{wm<4YLfh4UZV+8CDtA8Fm;xFnnvcYh;X^QD_V_#uyWgYNOsb)@U;}7@fvR#zx~p z;}gcE#^uJ9#%GM{ja!Yc7+*8)GVV3*Grn&;Vmxj}^qkC`@|Ovth2G~_hqtj*b!b1LW4T%0S&P0Y>C W&CR6`s=*(_@ZX%B|Mq?64){N9!p9H* literal 0 HcmV?d00001 diff --git a/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m b/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m index a45c5e9..98989c1 100644 --- a/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m +++ b/TYAlertControllerDemo/TYAlertController/TYShowAlertView.m @@ -15,7 +15,7 @@ @interface TYShowAlertView () @end //current window -#define kCurrentWindow [[UIApplication sharedApplication].windows firstObject] +#define kCurrentWindow [UIApplication sharedApplication].keyWindow @implementation TYShowAlertView