Skip to content

Commit

Permalink
Fix issue #36
Browse files Browse the repository at this point in the history
  • Loading branch information
iTofu committed Apr 28, 2017
1 parent 54cbd8c commit cc57e89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
9 changes: 8 additions & 1 deletion Demo/LCActionSheetDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "ViewController.h"
#import <LCActionSheet/LCActionSheet.h>
#import <Masonry/Masonry.h>

#define KEY_WINDOW [UIApplication sharedApplication].keyWindow

Expand All @@ -33,12 +34,18 @@ - (void)viewDidLoad {
});
textField.placeholder = @"Tap screen to hide keyboard..";
textField.backgroundColor = [UIColor whiteColor];
textField.layer.cornerRadius = 4.0;
textField.layer.shadowColor = [UIColor blackColor].CGColor;
textField.layer.shadowRadius = 2;
textField.layer.shadowOpacity = 0.3;
textField.layer.shadowOffset = CGSizeMake(0, 1.2);
textField.frame = CGRectMake(10.0, 25.0, [UIScreen mainScreen].bounds.size.width - 10.0 * 2, 44.0);
[self.view addSubview:textField];
[textField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(10.0);
make.right.equalTo(self.view).offset(-10.0);
make.top.equalTo(self.view).offset(30.0);
make.height.offset(44.0);
}];
}

- (void)viewWillAppear:(BOOL)animated {
Expand Down
14 changes: 9 additions & 5 deletions Sources/LCActionSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ - (void)appendButtonsWithTitles:(NSArray<NSString *> *)titles atIndexes:(NSIndex
[self updateBottomView];
[self updateTableView];
}

- (void)handleDidChangeStatusBarOrientation {
if (self.autoHideWhenDeviceRotated) {
[self hideWithButtonIndex:self.cancelButtonIndex];
Expand Down Expand Up @@ -729,13 +729,17 @@ - (void)show {

UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
window.windowLevel = UIWindowLevelStatusBar;
[window addSubview:self];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(window);
}];
[window makeKeyAndVisible];
self.window = window;

UIViewController *viewController = [[UIViewController alloc] init];
window.rootViewController = viewController;

[viewController.view addSubview:self];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(viewController.view);
}];

[self.window layoutIfNeeded];

__weak typeof(self) weakSelf = self;
Expand Down

0 comments on commit cc57e89

Please sign in to comment.