try to fix aboutView ok button
This commit is contained in:
1 parent
04ecd45f7c
commit
5fcfa84766
5 files changed
+19
-9
No files matched your search
@@ -10,8 +10,10 @@
|
||||
import SwiftUI
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
|
||||
public struct AboutView: View {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
public var aboutVC:UIViewController
|
||||
|
||||
public var body: some View {
|
||||
VStack(spacing: 10) {
|
||||
@@ -62,13 +64,12 @@ public struct AboutView: View {
|
||||
Spacer()
|
||||
// OK 按钮
|
||||
Button(SwiftLocalizationHelper.localizedString(forKey: "OK")) {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
aboutVC.dismiss(animated:true)
|
||||
}
|
||||
.padding()
|
||||
.background(Color.blue)
|
||||
.foregroundColor(.white)
|
||||
.frame(height: 46)
|
||||
//.frame(width: 100)
|
||||
.cornerRadius(12)
|
||||
} else {
|
||||
HStack(spacing: 20) {
|
||||
@@ -94,6 +95,14 @@ public struct AboutView: View {
|
||||
.cornerRadius(12)
|
||||
.frame(height: 33)
|
||||
.frame(minWidth: 100)*/
|
||||
Button(SwiftLocalizationHelper.localizedString(forKey: "OK")) {
|
||||
aboutVC.dismiss(animated:true)
|
||||
}
|
||||
.padding()
|
||||
.background(Color.blue)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(12)
|
||||
.frame(height: 33)
|
||||
}
|
||||
.padding(.top, 10)
|
||||
}
|
||||
@@ -101,3 +110,4 @@ public struct AboutView: View {
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ import SwiftUI
|
||||
@objc class AboutViewController: UIViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let hostingVC = UIHostingController(rootView: AboutView())
|
||||
|
||||
let hostingVC = UIHostingController(rootView: AboutView( aboutVC: self))
|
||||
|
||||
addChild(hostingVC)
|
||||
hostingVC.view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(hostingVC.view)
|
||||
@@ -29,7 +30,6 @@ import SwiftUI
|
||||
|
||||
// 🎯 设置弹窗大小
|
||||
preferredContentSize = CGSize(width: 530, height: 450)
|
||||
//preferredContentSize = CGSize(width:150, height:120 )
|
||||
|
||||
// ⚠️ 一定要设置以下样式才会生效 preferredContentSize
|
||||
modalPresentationStyle = .formSheet
|
||||
|
||||
@@ -26,7 +26,7 @@ static CGRect layoutViewBounds;
|
||||
static OSCProfilesManager *_sharedManager = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
layoutViewBounds = viewBounds;
|
||||
NSLog(@"bounds width: %f, height: %f", layoutViewBounds.size.width, layoutViewBounds.size.height);
|
||||
// NSLog(@"bounds width: %f, height: %f", layoutViewBounds.size.width, layoutViewBounds.size.height);
|
||||
dispatch_once(&onceToken, ^{
|
||||
_sharedManager = [[self alloc] init];
|
||||
});
|
||||
|
||||
@@ -472,7 +472,7 @@ import UIKit
|
||||
if vibrationOn {
|
||||
vibrationGenerator.prepare()
|
||||
vibrationGenerator.impactOccurred()
|
||||
print("vibrationInstance: \(vibrationGenerator)")
|
||||
// print("vibrationInstance: \(vibrationGenerator)")
|
||||
}
|
||||
|
||||
return indicatorBorder
|
||||
@@ -864,7 +864,7 @@ import UIKit
|
||||
if vibrationOn {
|
||||
vibrationGenerator.prepare()
|
||||
vibrationGenerator.impactOccurred()
|
||||
print("vibrationInstance: \(vibrationGenerator)")
|
||||
// print("vibrationInstance: \(vibrationGenerator)")
|
||||
}
|
||||
CATransaction.commit()
|
||||
}
|
||||
|
||||
@@ -1941,7 +1941,7 @@ static NSMutableSet* hostList;
|
||||
// This function forces immediate decoding of the UIImage, rather
|
||||
// than the default lazy decoding that results in janky scrolling.
|
||||
-(void)deviceOrientationDidChange{
|
||||
if(self.collectionView.superview == nil) return;
|
||||
if(self.revealViewController.isStreaming || self.collectionView.superview == nil) return;
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[self.collectionView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
|
||||
[self.collectionView.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor],
|
||||
|
||||
Reference in new issue
Block a user