Skip to content

Commit eaf9f84

Browse files
SPStoreSPStore
authored andcommitted
有文本输入框时,不进行镂空处理
有文本输入框时,不进行镂空处理。更准确的适配iPhoneX,适配横竖屏
1 parent ff38143 commit eaf9f84

8 files changed

Lines changed: 23 additions & 24 deletions

File tree

Example/SPAlertController.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
09037D1D1F9C91ED00975ABA /* image9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 09037D131F9C91ED00975ABA /* image9.jpg */; };
2020
090766991F987CF500C6E243 /* SPAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 090766981F987CF500C6E243 /* SPAlertController.m */; };
2121
091514641FBD365900ED5E53 /* PassWordView.m in Sources */ = {isa = PBXBuildFile; fileRef = 091514631FBD365900ED5E53 /* PassWordView.m */; };
22-
091514661FBD91B400ED5E53 /* 背景1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 091514651FBD91B400ED5E53 /* 背景1.jpg */; };
23-
091514681FBD9AA100ED5E53 /* 背景2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 091514671FBD9AA100ED5E53 /* 背景2.jpg */; };
24-
0915146A1FBD9E2500ED5E53 /* 背景3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 091514691FBD9E2500ED5E53 /* 背景3.jpg */; };
25-
0915146C1FBD9E3400ED5E53 /* 背景4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 0915146B1FBD9E3400ED5E53 /* 背景4.jpg */; };
2622
09175DF81FBC471A00422C3A /* MyHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 09175DF71FBC471A00422C3A /* MyHeaderView.m */; };
23+
091CF2271FC14A6F0019FA89 /* 背景2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 091CF2231FC14A6E0019FA89 /* 背景2.jpg */; };
24+
091CF2281FC14A6F0019FA89 /* 背景4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 091CF2241FC14A6E0019FA89 /* 背景4.jpg */; };
25+
091CF22B1FC14BAA0019FA89 /* 背景1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 091CF22A1FC14BAA0019FA89 /* 背景1.jpg */; };
26+
091CF22D1FC1518A0019FA89 /* 背景3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 091CF22C1FC151890019FA89 /* 背景3.jpg */; };
2727
091E3A641FB97C4500A980F1 /* MyCenterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 091E3A521FB97C4500A980F1 /* MyCenterView.m */; };
2828
091E3A651FB97C4500A980F1 /* MyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 091E3A551FB97C4500A980F1 /* MyView.xib */; };
2929
091E3A661FB97C4500A980F1 /* MyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 091E3A571FB97C4500A980F1 /* MyView.m */; };
@@ -76,12 +76,12 @@
7676
090766981F987CF500C6E243 /* SPAlertController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPAlertController.m; sourceTree = "<group>"; };
7777
091514621FBD365900ED5E53 /* PassWordView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassWordView.h; sourceTree = "<group>"; };
7878
091514631FBD365900ED5E53 /* PassWordView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PassWordView.m; sourceTree = "<group>"; };
79-
091514651FBD91B400ED5E53 /* 背景1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景1.jpg"; sourceTree = "<group>"; };
80-
091514671FBD9AA100ED5E53 /* 背景2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景2.jpg"; sourceTree = "<group>"; };
81-
091514691FBD9E2500ED5E53 /* 背景3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景3.jpg"; sourceTree = "<group>"; };
82-
0915146B1FBD9E3400ED5E53 /* 背景4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景4.jpg"; sourceTree = "<group>"; };
8379
09175DF61FBC471A00422C3A /* MyHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyHeaderView.h; sourceTree = "<group>"; };
8480
09175DF71FBC471A00422C3A /* MyHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyHeaderView.m; sourceTree = "<group>"; };
81+
091CF2231FC14A6E0019FA89 /* 背景2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景2.jpg"; sourceTree = "<group>"; };
82+
091CF2241FC14A6E0019FA89 /* 背景4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景4.jpg"; sourceTree = "<group>"; };
83+
091CF22A1FC14BAA0019FA89 /* 背景1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景1.jpg"; sourceTree = "<group>"; };
84+
091CF22C1FC151890019FA89 /* 背景3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景3.jpg"; sourceTree = "<group>"; };
8585
091E3A511FB97C4500A980F1 /* MyCenterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyCenterView.h; sourceTree = "<group>"; };
8686
091E3A521FB97C4500A980F1 /* MyCenterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyCenterView.m; sourceTree = "<group>"; };
8787
091E3A551FB97C4500A980F1 /* MyView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MyView.xib; sourceTree = "<group>"; };
@@ -167,10 +167,10 @@
167167
090BDF9E1F9C8C4800859CB3 /* Images */ = {
168168
isa = PBXGroup;
169169
children = (
170-
091514651FBD91B400ED5E53 /* 背景1.jpg */,
171-
091514671FBD9AA100ED5E53 /* 背景2.jpg */,
172-
091514691FBD9E2500ED5E53 /* 背景3.jpg */,
173-
0915146B1FBD9E3400ED5E53 /* 背景4.jpg */,
170+
091CF22A1FC14BAA0019FA89 /* 背景1.jpg */,
171+
091CF2231FC14A6E0019FA89 /* 背景2.jpg */,
172+
091CF22C1FC151890019FA89 /* 背景3.jpg */,
173+
091CF2241FC14A6E0019FA89 /* 背景4.jpg */,
174174
09037D0A1F9C91ED00975ABA /* image0.jpg */,
175175
09037D0B1F9C91ED00975ABA /* image1.jpg */,
176176
09037D0C1F9C91ED00975ABA /* image2.jpg */,
@@ -422,24 +422,24 @@
422422
isa = PBXResourcesBuildPhase;
423423
buildActionMask = 2147483647;
424424
files = (
425+
091CF2281FC14A6F0019FA89 /* 背景4.jpg in Resources */,
425426
09037D1C1F9C91ED00975ABA /* image8.jpg in Resources */,
426427
091E3A701FB97DEC00A980F1 /* MyFooterView.xib in Resources */,
427428
09037D171F9C91ED00975ABA /* image3.jpg in Resources */,
428429
091E3A651FB97C4500A980F1 /* MyView.xib in Resources */,
429430
09037D151F9C91ED00975ABA /* image1.jpg in Resources */,
430-
0915146C1FBD9E3400ED5E53 /* 背景4.jpg in Resources */,
431431
09037D1B1F9C91ED00975ABA /* image7.jpg in Resources */,
432432
09037D141F9C91ED00975ABA /* image0.jpg in Resources */,
433433
09037D1D1F9C91ED00975ABA /* image9.jpg in Resources */,
434+
091CF22D1FC1518A0019FA89 /* 背景3.jpg in Resources */,
434435
091E3A681FB97C4500A980F1 /* ShoppingCartCell.xib in Resources */,
435-
091514661FBD91B400ED5E53 /* 背景1.jpg in Resources */,
436436
0952D6781F8F554E00E4361F /* LaunchScreen.storyboard in Resources */,
437437
09037D1A1F9C91ED00975ABA /* image6.jpg in Resources */,
438438
09037D181F9C91ED00975ABA /* image4.jpg in Resources */,
439439
09037D191F9C91ED00975ABA /* image5.jpg in Resources */,
440-
0915146A1FBD9E2500ED5E53 /* 背景3.jpg in Resources */,
440+
091CF22B1FC14BAA0019FA89 /* 背景1.jpg in Resources */,
441441
0952D6751F8F554E00E4361F /* Assets.xcassets in Resources */,
442-
091514681FBD9AA100ED5E53 /* 背景2.jpg in Resources */,
442+
091CF2271FC14A6F0019FA89 /* 背景2.jpg in Resources */,
443443
09037D161F9C91ED00975ABA /* image2.jpg in Resources */,
444444
0952D6731F8F554E00E4361F /* Main.storyboard in Resources */,
445445
);
5.95 KB
Loading
-29.8 KB
Loading
-135 KB
Loading
38.7 KB
Loading

Example/SPAlertController/SPAlertController/SPAlertController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#define actionHeight 49.0
2222
#define lineWidth 0.5
2323

24-
#define isIPhoneX ([UIScreen mainScreen].bounds.size.height==812 || [UIScreen mainScreen].bounds.size.width==812)
25-
#define alertBottomMargin (isIPhoneX ? 34 : 0) // 适配iPhoneX
24+
#define isIPhoneX ([UIScreen mainScreen].bounds.size.height==812)
25+
#define alertBottomMargin (([UIScreen mainScreen].bounds.size.height==812)||([UIScreen mainScreen].bounds.size.width==812) ? 34 : 0) // 适配iPhoneX
2626

2727
static NSString * const FOOTERCELL = @"footerCell";
2828

@@ -1680,7 +1680,7 @@ - (void)redrawWithView:(UIView *)view alertController:(SPAlertController *)alert
16801680
- (void)drawRect:(CGRect)rect {
16811681
[super drawRect:rect];
16821682
// 黑色带透明时进行镂空
1683-
if (self.alertController.backgroundViewAppearanceStyle == SPBackgroundViewAppearanceStyleTranslucent && self.alertController.needDialogBlur) {
1683+
if (self.alertController.backgroundViewAppearanceStyle == SPBackgroundViewAppearanceStyleTranslucent && self.alertController.needDialogBlur && !self.alertController.textFields.count) {
16841684
_cornerRadiusForAlert = (self.alertController.preferredStyle==SPAlertControllerStyleActionSheet)? 0 : self.alertController.cornerRadiusForAlert;
16851685
CGContextRef ctx = UIGraphicsGetCurrentContext();
16861686
CGRect rectIntersection = CGRectIntersection(self.frame, self.presentedView.frame);

Example/SPAlertController/ViewController.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,10 @@ - (void)passWordCompleteInput:(PassWordView *)passWord {
672672

673673
SPAlertController *alertVc = [SPAlertController alertControllerWithPreferredStyle:SPAlertControllerStyleAlert animationType:SPAlertAnimationTypeAlpha customHeaderView:headerView];
674674
alertVc.maxMarginForAlert = 75;
675-
[self presentViewController:alertVc animated:YES completion:nil];
676-
677-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
675+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
676+
[self presentViewController:alertVc animated:YES completion:nil];
677+
});
678+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
678679
[self dismissViewControllerAnimated:YES completion:nil];
679680
});
680681
}
@@ -720,10 +721,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
720721
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
721722
cell.textLabel.font = [UIFont systemFontOfSize:15];
722723
if (_lookBlur) {
723-
cell.textLabel.textColor = [UIColor whiteColor];
724724
cell.backgroundColor = [UIColor clearColor];
725725
} else {
726-
cell.textLabel.textColor = [UIColor blackColor];
727726
cell.backgroundColor = [UIColor whiteColor];
728727
}
729728
cell.textLabel.text = self.dataSource[indexPath.section][indexPath.row];

0 commit comments

Comments
 (0)