Skip to content

Commit

Permalink
发布1.0.6
Browse files Browse the repository at this point in the history
调整内部方法名 解决与Masonry冲突问题
增加头部点击关闭设置
修复在与键盘同时弹出时 被键盘遮挡的BUG
调整键盘显示时的适配处理 (原来会在键盘弹出后才进行调整 , 现在与键盘同时进行)
  • Loading branch information
lixiang1994 committed Jun 21, 2017
1 parent bade40f commit eba7f8a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Framework/LEEAlert/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.5</string>
<string>1.0.6</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
4 changes: 2 additions & 2 deletions LEEAlert.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "LEEAlert"
s.version = "1.0.5"
s.version = "1.0.6"
s.summary = "优雅的Alert ActionSheet"

s.homepage = "https://github.com/lixiang1994/LEEAlert"
Expand All @@ -13,7 +13,7 @@ s.author = { "LEE" => "[email protected]" }
s.platform = :ios
s.platform = :ios, "8.0"

s.source = { :git => "https://github.com/lixiang1994/LEEAlert.git", :tag => "1.0.5"}
s.source = { :git => "https://github.com/lixiang1994/LEEAlert.git", :tag => "1.0.6"}

s.source_files = "LEEAlert/**/*.{h,m}"

Expand Down
2 changes: 1 addition & 1 deletion LEEAlert/LEEAlert.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author LEE
* @copyright Copyright © 2016 - 2017年 lee. All rights reserved.
* @version V1.0.5
* @version V1.0.6
*/

#import <Foundation/Foundation.h>
Expand Down
57 changes: 19 additions & 38 deletions LEEAlert/LEEAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author LEE
* @copyright Copyright © 2016 - 2017年 lee. All rights reserved.
* @version V1.0.5
* @version V1.0.6
*/

#import "LEEAlert.h"
Expand Down Expand Up @@ -1482,45 +1482,25 @@ - (void)viewDidLoad{

[super viewDidLoad];

[self configNotification];

[self configAlert];
}

- (void)configNotification{

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShown:) name:UIKeyboardWillShowNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil];
}

- (void)keyboardWillShown:(NSNotification *)notify{

keyboardFrame = [[[notify userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];

isShowingKeyboard = YES;
}

- (void)keyboardWillHidden:(NSNotification *)notify{

keyboardFrame = [[[notify userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];

isShowingKeyboard = NO;
}

- (void)keyboardWillChangeFrame:(NSNotification *)notify{

}

- (void)keyboardDidChangeFrame:(NSNotification *)notify{

double duration = [[[notify userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];

keyboardFrame = [[[notify userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];

[UIView beginAnimations:@"keyboardDidChangeFrame" context:NULL];
isShowingKeyboard = keyboardFrame.origin.y < SCREEN_HEIGHT;

[UIView beginAnimations:@"keyboardWillChangeFrame" context:NULL];

[UIView setAnimationDuration:duration];

Expand Down Expand Up @@ -1559,18 +1539,20 @@ - (void)updateAlertLayoutWithViewWidth:(CGFloat)viewWidth ViewHeight:(CGFloat)vi

CGFloat tempAlertViewHeight = keyboardY - alertViewHeight < 20 ? keyboardY - 20 : alertViewHeight;

CGFloat tempAlertViewY = keyboardY - tempAlertViewHeight - 10;

CGFloat originalAlertViewY = (viewHeight - alertViewFrame.size.height) * 0.5f;

alertViewFrame.size.height = tempAlertViewHeight;

alertViewFrame.size.width = alertViewMaxWidth;

alertViewFrame.origin.x = (viewWidth - alertViewFrame.size.width) * 0.5f;

alertViewFrame.origin.y = keyboardY - alertViewFrame.size.height - 10;
alertViewFrame.origin.y = tempAlertViewY < originalAlertViewY ? tempAlertViewY : originalAlertViewY;

self.alertView.frame = alertViewFrame;

[self.alertView setContentOffset:CGPointZero animated:NO];

[self.alertView scrollRectToVisible:[self findFirstResponder:self.alertView].frame animated:YES];
}

Expand All @@ -1586,7 +1568,7 @@ - (void)updateAlertLayoutWithViewWidth:(CGFloat)viewWidth ViewHeight:(CGFloat)vi

alertViewFrame.origin.x = (viewWidth - alertViewMaxWidth) * 0.5f;

alertViewFrame.origin.y = (viewHeight - alertViewFrame.size.height) / 2;
alertViewFrame.origin.y = (viewHeight - alertViewFrame.size.height) * 0.5f;

self.alertView.frame = alertViewFrame;
}
Expand All @@ -1595,6 +1577,8 @@ - (void)updateAlertLayoutWithViewWidth:(CGFloat)viewWidth ViewHeight:(CGFloat)vi

- (void)updateAlertItemsLayout{

[UIView setAnimationsEnabled:NO];

alertViewHeight = 0.0f;

CGFloat alertViewMaxWidth = self.config.modelMaxWidthBlock(self.orientationType);
Expand Down Expand Up @@ -1711,6 +1695,8 @@ - (void)updateAlertItemsLayout{
}

self.alertView.contentSize = CGSizeMake(alertViewMaxWidth, alertViewHeight);

[UIView setAnimationsEnabled:YES];
}

- (void)configAlert{
Expand Down Expand Up @@ -1893,8 +1879,6 @@ - (void)configAlert{

if (weakSelf) {

[weakSelf configNotification];

[weakSelf updateAlertLayout];
}

Expand Down Expand Up @@ -2150,10 +2134,6 @@ - (void)viewDidLoad{
[self configActionSheet];
}

- (void)configNotification{

}

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator{

[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
Expand All @@ -2172,6 +2152,7 @@ - (void)updateActionSheetLayoutWithViewWidth:(CGFloat)viewWidth ViewHeight:(CGFl

CGFloat actionSheetViewMaxHeight = self.config.modelMaxHeightBlock(self.orientationType);

[UIView setAnimationsEnabled:NO];

__block CGFloat actionSheetViewHeight = 0.0f;

Expand Down Expand Up @@ -2261,6 +2242,8 @@ - (void)updateActionSheetLayoutWithViewWidth:(CGFloat)viewWidth ViewHeight:(CGFl

self.actionSheetView.contentSize = CGSizeMake(actionSheetViewMaxWidth, actionSheetViewHeight);

[UIView setAnimationsEnabled:YES];

CGFloat cancelActionTotalHeight = self.actionSheetCancelAction ? self.actionSheetCancelAction.actionHeight + self.config.modelActionSheetCancelActionSpaceWidth : 0.0f;

CGRect actionSheetViewFrame = self.actionSheetView.frame;
Expand Down Expand Up @@ -2499,8 +2482,6 @@ - (void)configActionSheet{

if (weakSelf) {

[weakSelf configNotification];

[weakSelf updateActionSheetLayout];
}

Expand Down
2 changes: 1 addition & 1 deletion LEEAlert/LEEAlertHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author LEE
* @copyright Copyright © 2016 - 2017年 lee. All rights reserved.
* @version V1.0.5
* @version V1.0.6
*/

#ifndef LEEAlertHelper_h
Expand Down
2 changes: 1 addition & 1 deletion LEEAlertDemo/LEEAlertDemo/AlertTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ - (void)base:(NSInteger)index{
tf = textField; //赋值
})
.LeeAction(@"好的", ^{

[tf resignFirstResponder];
})
.LeeCancelAction(@"取消", nil) // 点击事件的Block如果不需要可以传nil
Expand Down
7 changes: 7 additions & 0 deletions UPDATELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

# LEEAlert - 更新日志

V1.0.6
==============
调整内部方法名 解决与Masonry冲突问题
增加头部点击关闭设置
修复在与键盘同时弹出时 被键盘遮挡的BUG
调整键盘显示时的适配处理 (原来会在键盘弹出后才进行调整 , 现在与键盘同时进行)

V1.0.5
==============
修复actionsheet的action默认无分隔线的BUG
Expand Down

0 comments on commit eba7f8a

Please sign in to comment.