Skip to content

Commit

Permalink
v1.5 JFToastView 支持iPhone14 Pro系列 灵动岛 (Toast Style Support iPhone14 …
Browse files Browse the repository at this point in the history
…Pro + Dynamic Island)
  • Loading branch information
JerryFans committed Sep 16, 2022
1 parent 7e72e24 commit ed9c68d
Show file tree
Hide file tree
Showing 23 changed files with 530 additions and 416 deletions.
20 changes: 20 additions & 0 deletions Example/JFPopup/OCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@interface OCViewController ()
@property (nonatomic, strong) UIButton *button;
@property (nonatomic, strong) UIButton *button1;
@end

@implementation OCViewController
Expand All @@ -24,6 +25,15 @@ - (UIButton *)button {
return _button;
}

- (UIButton *)button1 {
if (!_button1) {
_button1 = [UIButton buttonWithType:UIButtonTypeCustom];
[_button1 setTitle:@"Dismiss" forState:UIControlStateNormal];
[_button1 setBackgroundColor:UIColor.blueColor];
}
return _button1;
}

- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"OC";
Expand All @@ -37,9 +47,19 @@ - (void)viewDidLoad {
[self.view addSubview:self.button];
self.button.frame = CGRectMake(50, 150, 150, 150);
[self.button addTarget:self action:@selector(clickMe) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:self.button1];
self.button1.frame = CGRectMake(50, 315, 150, 150);
[self.button1 addTarget:self action:@selector(clickMe1) forControlEvents:UIControlEventTouchUpInside];
// Do any additional setup after loading the view.
}

- (void)clickMe1 {
[self dismissViewControllerAnimated:YES completion:^{

}];
}

- (void)clickMe {
//暂时只兼容 这三种, 后续有issue 可以继续支持
int random = arc4random() % 3;
Expand Down
10 changes: 8 additions & 2 deletions Example/JFPopup/PopupInViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ class PopupInViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

var t: CGFloat = 0
if #available(iOS 11.0, *) {
t = UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0
}
print("safe area top: " + "\(t)")
self.title = "Popup From UIView"
self.view.backgroundColor = .white
self.view.addSubview(self.scrollView)
Expand All @@ -101,7 +107,7 @@ class PopupInViewController: UIViewController {

self.buildLabel(withTitle: "Toast Usage (v1.1 add)")

let btn6 = self.buildButton(withTitle: "普通toast,默认superview可以响应")
let btn6 = self.buildButton(withTitle: "默认toast,支持灵动岛否则默认剧中")
btn6.addTarget(self, action: #selector(clickAction6), for: .touchUpInside)

let btn7 = self.buildButton(withTitle: "自定义参数")
Expand Down Expand Up @@ -240,7 +246,7 @@ class PopupInViewController: UIViewController {
}

@objc func clickAction6() {
JFPopupView.popup.toast(hit: "普通toast,默认superview可以响应")
JFPopupView.popup.toast(hit: "默认toast,支持灵动岛")
}

@objc func clickAction8() {
Expand Down
4 changes: 3 additions & 1 deletion Example/JFPopup/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ class ViewController: UIViewController {
}

@objc func clickAction2() {
self.navigationController?.pushViewController(OCViewController(), animated: true)
// self.navigationController?.pushViewController(OCViewController(), animated: true)
let vc = OCViewController()
self.present(vc, animated: true)
}

@objc func clickAction1() {
Expand Down
1 change: 1 addition & 0 deletions Example/Pods/JRBaseKit/Classes/JF.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion Example/Pods/JRBaseKit/Classes/UIView+JFRect.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Example/Pods/Local Podspecs/JFPopup.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed9c68d

Please sign in to comment.