Skip to content

Commit 02e9fac

Browse files
committed
iOS 9 键盘遮挡 ActionSheet 的 Bud
1 parent 62403ba commit 02e9fac

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

Coding_iOS.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
4E0BD88A1B6C7F5B0061CAA6 /* TopicHotkeyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E0BD8891B6C7F5B0061CAA6 /* TopicHotkeyView.m */; };
9898
4E15C7D01A26D2F000FB8DAD /* FolderToMoveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E15C7CF1A26D2F000FB8DAD /* FolderToMoveViewController.m */; };
9999
4E15C7D61A271A6300FB8DAD /* EaseToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E15C7D51A271A6300FB8DAD /* EaseToolBar.m */; };
100+
4E19E7071BCE03CD00C66DC6 /* UIActionSheet+Front.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E19E7061BCE03CD00C66DC6 /* UIActionSheet+Front.m */; settings = {ASSET_TAGS = (); }; };
100101
4E1A22821AB1729700CFC14F /* ProjectInfoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E1A22811AB1729700CFC14F /* ProjectInfoCell.m */; };
101102
4E1A22851AB172C400CFC14F /* ProjectItemsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E1A22841AB172C400CFC14F /* ProjectItemsCell.m */; };
102103
4E1A22881AB1731600CFC14F /* ProjectDescriptionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E1A22871AB1731600CFC14F /* ProjectDescriptionCell.m */; };
@@ -1059,6 +1060,8 @@
10591060
4E15C7CF1A26D2F000FB8DAD /* FolderToMoveViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FolderToMoveViewController.m; sourceTree = "<group>"; };
10601061
4E15C7D41A271A6300FB8DAD /* EaseToolBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EaseToolBar.h; sourceTree = "<group>"; };
10611062
4E15C7D51A271A6300FB8DAD /* EaseToolBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EaseToolBar.m; sourceTree = "<group>"; };
1063+
4E19E7051BCE03CD00C66DC6 /* UIActionSheet+Front.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIActionSheet+Front.h"; sourceTree = "<group>"; };
1064+
4E19E7061BCE03CD00C66DC6 /* UIActionSheet+Front.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIActionSheet+Front.m"; sourceTree = "<group>"; };
10621065
4E1A22801AB1729700CFC14F /* ProjectInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectInfoCell.h; sourceTree = "<group>"; };
10631066
4E1A22811AB1729700CFC14F /* ProjectInfoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectInfoCell.m; sourceTree = "<group>"; };
10641067
4E1A22831AB172C400CFC14F /* ProjectItemsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectItemsCell.h; sourceTree = "<group>"; };
@@ -3183,6 +3186,8 @@
31833186
4ECE8AD61A3943E80021E29C /* UIViewController+Swizzle.m */,
31843187
4EBDA87A1A6640340035ED96 /* UIActionSheet+Common.h */,
31853188
4EBDA87B1A6640340035ED96 /* UIActionSheet+Common.m */,
3189+
4E19E7051BCE03CD00C66DC6 /* UIActionSheet+Front.h */,
3190+
4E19E7061BCE03CD00C66DC6 /* UIActionSheet+Front.m */,
31863191
4EB0C1FE1A807ED00042FC4F /* NSURL+Common.h */,
31873192
4EB0C1FF1A807ED00042FC4F /* NSURL+Common.m */,
31883193
4EE5481C1AE7B7CA00A92306 /* UISearchBar+Common.h */,
@@ -5449,6 +5454,7 @@
54495454
8EF83F8A19E92AA500E86DE7 /* SettingTagsViewController.m in Sources */,
54505455
8EF643D319FF7E2900F7EEB0 /* ValueListCell.m in Sources */,
54515456
4E217F0C1A70EDC700F6DF88 /* SVModalWebViewController.m in Sources */,
5457+
4E19E7071BCE03CD00C66DC6 /* UIActionSheet+Front.m in Sources */,
54525458
4EF17E5F1B3AB10F003CDD2D /* IntroductionViewController.m in Sources */,
54535459
4EA7F1601A6D192B00A046BD /* SDWebImagePrefetcher.m in Sources */,
54545460
4E4D6A941B1D851E00FD2E49 /* FileChanges.m in Sources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// UIActionSheet+Front.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/10/13.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface UIActionSheet (Front)
12+
13+
@end
14+
15+
void swizzleAllActionSheet();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// UIActionSheet+Front.m
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/10/13.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "UIActionSheet+Front.h"
10+
#import <objc/runtime.h>
11+
12+
@implementation UIActionSheet (Front)
13+
- (void)customShowInView:(UIView *)view{
14+
for(UIWindow * tmpWin in [[UIApplication sharedApplication] windows]){
15+
[tmpWin endEditing:NO];
16+
}
17+
[self customShowInView:view];
18+
}
19+
+ (void)load{
20+
swizzleAllActionSheet();
21+
}
22+
@end
23+
24+
void swizzleAllActionSheet(){
25+
Class c = [UIActionSheet class];
26+
SEL origSEL = @selector(showInView:);
27+
SEL newSEL = @selector(customShowInView:);
28+
Method origMethod = class_getInstanceMethod(c, origSEL);
29+
Method newMethod = class_getInstanceMethod(c, newSEL);
30+
method_exchangeImplementations(origMethod, newMethod);
31+
}

0 commit comments

Comments
 (0)