old iOS compatibility fixes:
- strong settingButton reference - hidden stackView heightContraint - navBarAppearance
This commit is contained in:
1 parent
fb32ef3629
commit
1737eae39b
9 files changed
+171
-100
No files matched your search
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="EVd-wq-ego">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="EVd-wq-ego">
|
||||
<device id="ipad11_0rounded" orientation="portrait" layout="fullscreen" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
|
||||
<capability name="Image references" minToolsVersion="12.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@@ -12,7 +12,7 @@
|
||||
<objects>
|
||||
<viewController id="wb7-af-jn8" customClass="MainFrameViewController" sceneMemberID="viewController">
|
||||
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" indicatorStyle="black" dataMode="prototypes" id="TZj-Lc-M9d" customClass="AppCollectionView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1136"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1120"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="20" minimumInteritemSpacing="20" id="f7l-kG-hJc">
|
||||
@@ -63,8 +63,8 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="682" height="2500"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="zpX-lo-MLA" userLabel="Resolutionstak">
|
||||
<rect key="frame" x="16" y="57" width="380" height="96.5"/>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="zpX-lo-MLA" userLabel="Resolutionstak">
|
||||
<rect key="frame" x="16" y="57" width="380" height="92.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clearsContextBeforeDrawing="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Resolution " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pYZ-GR-EwO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
|
||||
@@ -74,7 +74,7 @@
|
||||
<size key="shadowOffset" width="0.0" height="0.0"/>
|
||||
</label>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" apportionsSegmentWidthsByContent="YES" segmentControlStyle="plain" selectedSegmentIndex="5" translatesAutoresizingMaskIntoConstraints="NO" id="ckc-Dm-8ex">
|
||||
<rect key="frame" x="0.0" y="27.5" width="380" height="32"/>
|
||||
<rect key="frame" x="0.0" y="25.5" width="380" height="32"/>
|
||||
<segments>
|
||||
<segment title="360p" enabled="NO"/>
|
||||
<segment title="720p"/>
|
||||
@@ -88,7 +88,7 @@
|
||||
<color key="selectedSegmentTintColor" systemColor="linkColor"/>
|
||||
</segmentedControl>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="djj-8b-2pB" userLabel="ResolutionInnerStack2">
|
||||
<rect key="frame" x="0.0" y="65.5" width="380" height="31"/>
|
||||
<rect key="frame" x="0.0" y="61.5" width="380" height="31"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Custom Resolution" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hq8-dy-8BF">
|
||||
<rect key="frame" x="0.0" y="0.0" width="130" height="31"/>
|
||||
@@ -396,6 +396,7 @@
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="380" id="RoD-rl-0Us"/>
|
||||
<constraint firstAttribute="height" priority="999" constant="56.5" id="t3w-8N-xWr"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="2GS-cX-u4i" userLabel="swapABXYButtons Stack">
|
||||
@@ -876,7 +877,7 @@
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="01j-TU-OoL" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="video.and.waveform" catalog="system" id="20f-ao-iK1">
|
||||
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
|
||||
<rect key="frame" x="0.0" y="-4" width="240" height="128"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
<navigationBar contentMode="scaleToFill" id="3qa-QW-sSl">
|
||||
@@ -898,7 +899,7 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="YRO-Lg-RCg"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="hGs-BR-t4b">
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1210"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1194"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
@@ -937,7 +938,7 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="vu8-3s-HlY"/>
|
||||
</layoutGuides>
|
||||
<view key="view" multipleTouchEnabled="YES" contentMode="scaleToFill" id="SMn-1j-R3I">
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1210"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1194"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="0.3333357871" green="0.33332890269999998" blue="0.33333355190000002" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</view>
|
||||
@@ -959,7 +960,7 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="YZj-An-sqS"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="le1-tU-NEp">
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1210"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="1194"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="N0D-dj-EuF">
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
// MenuSectionView.h
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "DataManager.h"
|
||||
|
||||
@protocol HideOverlappedDynamicLabelDelegate <NSObject>
|
||||
@protocol MenuSectionDelegate <NSObject>
|
||||
- (void)hideOverlappedDynamicLabels;
|
||||
- (SettingsMenuMode)getSettingsMenuMode;
|
||||
@end
|
||||
|
||||
|
||||
@@ -27,7 +29,7 @@
|
||||
@property (nonatomic, assign) CGFloat headerViewHeight;
|
||||
@property (nonatomic, assign) CGFloat headerViewVerticalSpacing;
|
||||
@property (nonatomic, strong) NSMutableArray<UIStackView *> *subStackViews;
|
||||
@property (nonatomic, weak) id<HideOverlappedDynamicLabelDelegate> delegate; // Delegate property
|
||||
@property (nonatomic, weak) id<MenuSectionDelegate> delegate; // Delegate property
|
||||
|
||||
// 方法
|
||||
- (void)setSectionWithIcon:(UIImage *)icon andSize:(CGFloat)size;
|
||||
|
||||
@@ -309,12 +309,23 @@
|
||||
[self updateViewForFoldState];
|
||||
}
|
||||
|
||||
- (SettingsMenuMode)getSettingsMenuMode {
|
||||
if ([self.delegate respondsToSelector:@selector(getSettingsMenuMode)]) {
|
||||
return [self.delegate getSettingsMenuMode];
|
||||
} else return AllSettings;
|
||||
}
|
||||
|
||||
|
||||
- (void)updateViewForFoldState {
|
||||
if([self getSettingsMenuMode] != AllSettings) return;
|
||||
[self setNeedsLayout];
|
||||
[self layoutIfNeeded];
|
||||
[self setupConstraints];
|
||||
if (_expanded) {
|
||||
_rootStackView.hidden = NO;
|
||||
_separatorLine.hidden = NO;
|
||||
CGSize fittingSize = [self.rootStackView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
|
||||
//CGSize fittingSize = [self.rootStackView systemLayoutSizeFittingSize:UILayoutFittingExpandedSize];
|
||||
CGFloat rootStackViewHeight = fittingSize.height;
|
||||
fittingSize = [self.headerView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
|
||||
CGFloat headerHeight = fittingSize.height;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
@interface MainFrameViewController : UICollectionViewController <DiscoveryCallback, PairCallback, HostCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate, HostCardActionDelegate>
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIBarButtonItem *settingsButton;
|
||||
@property (nonatomic, strong) IBOutlet UIBarButtonItem *settingsButton;
|
||||
#if !TARGET_OS_TV
|
||||
@property (nonatomic, assign) bool settingsExpandedInStreamView;
|
||||
@property (nonatomic, strong) HostCollectionViewController *hostCollectionVC;
|
||||
|
||||
@@ -70,11 +70,8 @@
|
||||
bool _background;
|
||||
UIView* menuSeparator;
|
||||
UIView* snapshot;
|
||||
|
||||
SettingsViewController* settingsViewController;
|
||||
|
||||
UINavigationBarAppearance *navBarAppearanceStandard;
|
||||
UINavigationBarAppearance *navBarAppearanceScroll;
|
||||
id navBarAppearanceStandard;
|
||||
|
||||
#if TARGET_OS_TV
|
||||
UITapGestureRecognizer* _menuRecognizer;
|
||||
@@ -142,10 +139,11 @@ static NSMutableSet* hostList;
|
||||
- (void)updateTitle {
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
navBarAppearanceScroll.titleTextAttributes = navBarAppearanceStandard.titleTextAttributes = @{
|
||||
NSDictionary* titleTextAttributes = @{
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:20 weight:UIFontWeightMedium],
|
||||
NSForegroundColorAttributeName: [ThemeManager textColor] // 可选,设置标题颜色
|
||||
};
|
||||
[navBarAppearanceStandard setValue:titleTextAttributes forKey:@"titleTextAttributes"];
|
||||
}
|
||||
|
||||
if (_selectedHost != nil) {
|
||||
@@ -157,10 +155,11 @@ static NSMutableSet* hostList;
|
||||
}
|
||||
else {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
navBarAppearanceScroll.titleTextAttributes = navBarAppearanceStandard.titleTextAttributes = @{
|
||||
NSDictionary* titleTextAttributes = @{
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:24 weight:UIFontWeightSemibold],
|
||||
NSForegroundColorAttributeName: [ThemeManager textColor] // 可选,设置标题颜色
|
||||
};
|
||||
[navBarAppearanceStandard setValue:titleTextAttributes forKey:@"titleTextAttributes"];
|
||||
}
|
||||
/*
|
||||
self.navigationController.navigationBar.titleTextAttributes = @{
|
||||
@@ -170,11 +169,7 @@ static NSMutableSet* hostList;
|
||||
self.title = [LocalizationHelper localizedStringForKey: @"Hosts" ];
|
||||
//self.title = nil;
|
||||
}
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[self applyNavBarAppearance];
|
||||
} else {
|
||||
self.navigationController.navigationBar.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)alreadyPaired {
|
||||
@@ -1121,18 +1116,38 @@ static NSMutableSet* hostList;
|
||||
else [revealController buttonsNotInStreaming];
|
||||
|
||||
//[settingsViewController.resolutionSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
settingsViewController.resolutionStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.fpsStack.hidden = self.settingsExpandedInStreamView;
|
||||
//settingsViewController.resolutionStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.resolutionStack];
|
||||
//settingsViewController.fpsStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.fpsStack];
|
||||
|
||||
[settingsViewController widget:settingsViewController.bitrateSlider setEnabled:!self.settingsExpandedInStreamView];
|
||||
//settingsViewController.bitrateStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.optimizeGamesStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.audioOnPcStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.codecStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.yuv444Stack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.HdrStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.framepacingStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.citrixX1MouseStack.hidden = self.settingsExpandedInStreamView;
|
||||
settingsViewController.externalDisplayModeStack.hidden = self.settingsExpandedInStreamView;
|
||||
//settingsViewController.optimizeGamesStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.optimizeGamesStack];
|
||||
|
||||
//settingsViewController.audioOnPcStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.audioOnPcStack];
|
||||
|
||||
//settingsViewController.codecStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.codecStack];
|
||||
|
||||
|
||||
//settingsViewController.yuv444Stack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.yuv444Stack];
|
||||
|
||||
//settingsViewController.HdrStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.HdrStack];
|
||||
|
||||
//settingsViewController.framepacingStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.framepacingStack];
|
||||
|
||||
//settingsViewController.citrixX1MouseStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.citrixX1MouseStack];
|
||||
|
||||
//settingsViewController.externalDisplayModeStack.hidden = self.settingsExpandedInStreamView;
|
||||
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.externalDisplayModeStack];
|
||||
|
||||
// [settingsViewController.unlockDisplayOrientationSelector setEnabled:!self.settingsExpandedInStreamView && [self isFullScreenRequired]];//need "requires fullscreen" enabled in the app bunddle to make runtime orientation limitation woring
|
||||
}
|
||||
|
||||
@@ -1368,41 +1383,36 @@ static NSMutableSet* hostList;
|
||||
]];
|
||||
}
|
||||
|
||||
- (void)applyNavBarAppearance API_AVAILABLE(ios(13.0)){
|
||||
- (void)applyNavBarAppearance{
|
||||
if (@available(iOS 13.0, *)) {
|
||||
self.navigationController.navigationBar.standardAppearance.backgroundColor = [UIColor clearColor]; // old ios depend on this, do not remove
|
||||
self.navigationController.navigationBar.standardAppearance = navBarAppearanceStandard;
|
||||
self.navigationController.navigationBar.scrollEdgeAppearance = navBarAppearanceStandard;
|
||||
}
|
||||
else{
|
||||
self.navigationController.navigationBar.backgroundColor = [UIColor clearColor]; // old ios depend on this, do not remove
|
||||
self.navigationController.navigationBar.barTintColor = [UIColor clearColor]; // ios 14 depend on this, do not remove
|
||||
self.navigationController.navigationBar.barTintColor = [ThemeManager appBackgroundColor]; // ios 14 depend on this, do not remove
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setupNavBar{
|
||||
if (@available(iOS 13.0, *)) {
|
||||
navBarAppearanceStandard = [[UINavigationBarAppearance alloc] init];
|
||||
[navBarAppearanceStandard configureWithOpaqueBackground]; // 不透明
|
||||
navBarAppearanceStandard.backgroundColor =[ThemeManager appBackgroundColor];; // 设置你需要的背景色
|
||||
navBarAppearanceStandard.shadowColor = nil; // 去掉底部分割线(可选)
|
||||
navBarAppearanceStandard.titleTextAttributes = @{
|
||||
Class appearanceClass = NSClassFromString(@"UINavigationBarAppearance");
|
||||
navBarAppearanceStandard = [[appearanceClass alloc] init];
|
||||
[navBarAppearanceStandard performSelector:@selector(configureWithOpaqueBackground)]; // 不透明
|
||||
[navBarAppearanceStandard setValue:[ThemeManager appBackgroundColor] forKey:@"backgroundColor"]; // 设置你需要的背景色
|
||||
[navBarAppearanceStandard setValue:nil forKey:@"shadowColor"]; // 设置你需要的背景色
|
||||
NSDictionary* titleTextAttributes = @{
|
||||
NSForegroundColorAttributeName: [ThemeManager textColor]
|
||||
};
|
||||
navBarAppearanceStandard.shadowColor = [UIColor clearColor];
|
||||
navBarAppearanceStandard.backgroundImage = nil;
|
||||
[navBarAppearanceStandard setValue:titleTextAttributes forKey:@"titleTextAttributes"];
|
||||
[navBarAppearanceStandard setValue:[UIColor clearColor] forKey:@"shadowColor"];
|
||||
[navBarAppearanceStandard setValue:nil forKey:@"backgroundImage"];
|
||||
|
||||
/*
|
||||
navBarAppearanceScroll = [[UINavigationBarAppearance alloc] init];
|
||||
[navBarAppearanceScroll configureWithTransparentBackground];
|
||||
navBarAppearanceScroll.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
|
||||
navBarAppearanceScroll.backgroundColor =[[ThemeManager appBackgroundColor] colorWithAlphaComponent:0.6]; // 设置你需要的背景色
|
||||
//navBarAppearanceScroll.shadowColor = nil; // 去掉底部分割线(可选)
|
||||
navBarAppearanceScroll.titleTextAttributes = @{
|
||||
NSForegroundColorAttributeName: [ThemeManager textColor]
|
||||
};
|
||||
// navBarAppearanceScroll.shadowColor = [UIColor clearColor];
|
||||
navBarAppearanceScroll.backgroundImage = nil;*/
|
||||
|
||||
//appearance.
|
||||
//navBarAppearanceStandard.backgroundImage = nil;
|
||||
}
|
||||
[self applyNavBarAppearance];
|
||||
}
|
||||
else {
|
||||
self.navigationController.navigationBar.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
}
|
||||
|
||||
self->_addHostButton = [self createAddHostButton];
|
||||
self->_helpButton = [self createHelpButton];
|
||||
@@ -1419,7 +1429,7 @@ static NSMutableSet* hostList;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[_settingsButton setTitle:nil];
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
[_settingsButton setImage:image];
|
||||
_settingsButton.imageInsets = UIEdgeInsetsMake(10, 10, 0, 0);
|
||||
} else {
|
||||
|
||||
@@ -871,8 +871,6 @@ const int FrontViewPositionNone = 0xff;
|
||||
#pragma mark - Public methods and property accessors
|
||||
|
||||
- (void)willMoveToPosition{
|
||||
|
||||
|
||||
SettingsMenuMode currentMenuMode = [self getSettingsMenuMode];
|
||||
|
||||
_separatorLine.hidden = _frontViewPosition == FrontViewPositionLeft;
|
||||
@@ -883,9 +881,9 @@ const int FrontViewPositionNone = 0xff;
|
||||
|
||||
if(_frontViewPosition != FrontViewPositionLeft){
|
||||
[self setupMoreButtonMenu];
|
||||
[self layoutSettingsView];
|
||||
//if(currentMenuMode == AllSettings) [self allSettingSelected];
|
||||
//if(currentMenuMode == FavoriteSettings) [self favoriteSettingSelected];
|
||||
[self layoutSettingsView]; //注意, 该方法在菜单展开前又运行了一次, 会执行按清单隐藏stack的任务,此时直接使用.hidden = false 的方式,将stack从hiddenstacks清单中移除,导致stack保持隐藏无法恢复;
|
||||
//而此willMoveToPosition内部方法,发生在 delegate的willMoveToPosition之后(由mainFrameVC执行的委托)
|
||||
//因此应在mainFrameVC中的willMoveToPosition委托方法中先行setHidden:false,更新hiddenStack清单, 再在此内部方法中运行layoutSettingsView,确保因串流中展开而隐藏的stack可以正确恢复
|
||||
}
|
||||
else{
|
||||
// _rearViewRevealWidth = _rearViewRevealWidth + 20;
|
||||
@@ -943,7 +941,8 @@ const int FrontViewPositionNone = 0xff;
|
||||
_dockedNavBar.scrollEdgeAppearance = navBarAppearanceStandard;
|
||||
} else {
|
||||
_dockedNavBar.backgroundColor = [UIColor clearColor];
|
||||
_dockedNavBar.barTintColor = [[ThemeManager appBackgroundColor] colorWithAlphaComponent:0.1];
|
||||
_dockedNavBar.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
_dockedNavBar.shadowImage = [UIImage new]; // remove bottom line for navbar
|
||||
}
|
||||
|
||||
|
||||
@@ -983,7 +982,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[backButton setTitle:nil];
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
[backButton setImage:image];
|
||||
backButton.imageInsets = UIEdgeInsetsMake(20, 10, 0, 0);
|
||||
} else {
|
||||
@@ -1024,7 +1023,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[_moreButton setTitle:nil];
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"ellipsis.circle" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"ellipsis.circle" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
[_moreButton setImage:image];
|
||||
_moreButton.imageInsets = UIEdgeInsetsMake(20, 0, 0, -10);
|
||||
} else {
|
||||
@@ -1198,10 +1197,16 @@ const int FrontViewPositionNone = 0xff;
|
||||
}
|
||||
|
||||
- (void)disconnectRemoteSession{
|
||||
//先不要运行foldRearView, 以确保在断开时可以捕获 hiddenStacks (在串流中展开时已被设置了setHidden),执行临时hidden = false,并重新计算heightContraint, 因此可确保substacks发生转移前恢复原有高度。以下切换all/favorite的方法内置了layoutSettingsView方法,该方法会在新的superView根据额外维护的清单隐藏stack,从而避免stack以hidden状态发生superView转移。
|
||||
if([self getSettingsMenuMode] == RemoveSettingItem) [self doneRemoveSettingItemSelected];
|
||||
if([self getSettingsMenuMode] == AllSettings) [self allSettingSelected];
|
||||
if([self getSettingsMenuMode] == FavoriteSettings) [self favoriteSettingSelected];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"SessionDisconnectedBySettingsMenuNotification" object:self];
|
||||
// foldRearView此时, 收起时先通过mainFrame委托方法触发setHidden:false(hidden=false, 并更新清单) 再由内部willMoveToPosition运行layoutSettingsView,根据清单执行隐藏, 确保经过setHidden:false的stack可以恢复显示。
|
||||
[self foldRearView];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"SessionDisconnectedBySettingsMenuNotification" object:self];
|
||||
|
||||
// 以上两段没有执行顺序要求,因为第一段放后面的话, 也能保证stack不会在hidden状态下被转移到新的superView
|
||||
}
|
||||
|
||||
-(void)deviceOrientationDidChange{
|
||||
|
||||
@@ -16,42 +16,42 @@
|
||||
#import "CustomEdgeSlideGestureRecognizer.h"
|
||||
#import "MenuSectionView.h"
|
||||
|
||||
@interface SettingsViewController : UIViewController <RearNavigationBarMenuDelegate, HideOverlappedDynamicLabelDelegate>
|
||||
@interface SettingsViewController : UIViewController <RearNavigationBarMenuDelegate, MenuSectionDelegate>
|
||||
@property (strong, nonatomic) IBOutlet UINavigationBar *navigationBar;
|
||||
@property (strong, nonatomic) UIStackView *parentStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *resolutionStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *fpsStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *bitrateStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *touchModeStack;
|
||||
@property (weak, nonatomic) IBOutlet UIStackView *enableOswSwitchStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *enableOswSwitchStack;
|
||||
//@property (strong, nonatomic) IBOutlet UIStackView *asyncTouchStack;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *optimizeGamesSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *optimizeGamesSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *pointerVelocityDividerStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *pointerVelocityFactorStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *touchMoveEventIntervalStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *mousePointerVelocityStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *onScreenWidgetStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *softKeyboardGestureStack;
|
||||
@property (weak, nonatomic) IBOutlet UISegmentedControl *softKeyboardGestureSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *softKeyboardGestureSelector;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *liftStreamViewForKeyboardStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *softKeyboardToolbarStack;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *softKeyboardToolbarSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *softKeyboardToolbarSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *slideToSettingsScreenEdgeStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *slideToToolboxScreenEdgeStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *slideToSettingsDistanceStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *optimizeGamesStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *multiControllerStack;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *multiControllerSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *multiControllerSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *swapAbaxyStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *audioOnPcStack;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *audioOnPcSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *audioOnPcSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *codecStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *yuv444Stack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *HdrStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *framepacingStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *reverseMouseWheelDirectionStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *citrixX1MouseStack;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *citrixX1MouseSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *citrixX1MouseSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *statsOverlayStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *unlockDisplayOrientationStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *externalDisplayModeStack;
|
||||
@@ -61,17 +61,17 @@
|
||||
@property (strong, nonatomic) IBOutlet UISlider *bitrateSlider;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *framerateSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *customResolutionSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *customResolutionSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UILabel *touchModeLabel;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *touchModeSelector;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *enableOswForNativeTouchSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *enableOswForNativeTouchSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UILabel *onscreenControllerLabel;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *onScreenWidgetSelector;
|
||||
//@property (strong, nonatomic) IBOutlet UISegmentedControl *asyncNativeTouchPrioritySelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *swapABXYButtonsSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *codecSelector;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *hdrSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *yuv444Switch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *hdrSwitch;
|
||||
@property (strong, nonatomic) IBOutlet UISwitch *yuv444Switch;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *framePacingSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *reverseMouseWheelDirectionSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *statsOverlaySelector;
|
||||
@@ -112,6 +112,6 @@
|
||||
- (void)widget:(UISlider*)widget setEnabled:(bool)enabled;
|
||||
- (void)updateTheme;
|
||||
- (void)hideDynamicLabelsWhenOverlapped:(UIView* )view;
|
||||
|
||||
- (void)setHidden:(BOOL)hidden forStack:(UIStackView* )stack;
|
||||
|
||||
@end
|
||||
@@ -36,6 +36,7 @@
|
||||
CGFloat _scrollSpeed;
|
||||
CGFloat _currentRefreshRate;
|
||||
MenuSectionView *touchControlSection;
|
||||
NSMutableSet* hiddenStacks;
|
||||
}
|
||||
|
||||
@dynamic overrideUserInterfaceStyle;
|
||||
@@ -1024,17 +1025,39 @@ BOOL isCustomResolution(CGSize res) {
|
||||
}
|
||||
|
||||
- (void)layoutSettingsView{
|
||||
[self.view layoutSubviews];
|
||||
[self.scrollView layoutSubviews];
|
||||
|
||||
//switchToAll/Favorite 调用此方法时,这些hiddenStack已身处新的superView中, 可以正常执行hidden = YES
|
||||
for(UIStackView* stack in hiddenStacks) stack.hidden = YES;
|
||||
|
||||
if(currentSettingsMenuMode == AllSettings){
|
||||
for(MenuSectionView* section in _parentStack.arrangedSubviews) [section updateViewForFoldState];
|
||||
}
|
||||
[self hideDynamicLabelsWhenOverlapped:self.parentStack];
|
||||
}
|
||||
|
||||
- (void)switchToFavoriteSettings{
|
||||
for(UIView* view in _parentStack.subviews){
|
||||
[view removeFromSuperview];
|
||||
// 旧版本iOS兼容必要
|
||||
- (void)forceRestoreHeightTemporarilyForSettingStackParentView{
|
||||
for(UIStackView* stack in hiddenStacks) stack.hidden = NO;
|
||||
if(currentSettingsMenuMode == AllSettings){
|
||||
for(UIView* view in _parentStack.arrangedSubviews){
|
||||
if([view isKindOfClass:[MenuSectionView class]]){
|
||||
MenuSectionView* section = (MenuSectionView* )view;
|
||||
[section updateViewForFoldState];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
NSLayoutConstraint* heightConstraint = [_parentStack.heightAnchor constraintEqualToConstant:666];
|
||||
heightConstraint.active = YES;
|
||||
CGSize fittingSize = [_parentStack systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
|
||||
heightConstraint.constant = fittingSize.height;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)switchToFavoriteSettings{
|
||||
[self forceRestoreHeightTemporarilyForSettingStackParentView];
|
||||
[_parentStack removeFromSuperview];
|
||||
currentSettingsMenuMode = FavoriteSettings;
|
||||
[self initParentStack];
|
||||
[self updateTheme];
|
||||
@@ -1050,13 +1073,13 @@ BOOL isCustomResolution(CGSize res) {
|
||||
[_parentStack addArrangedSubview:_settingStackDict[settingIdentifier]];
|
||||
}
|
||||
[self hideDynamicLabelsWhenOverlapped:self.parentStack];
|
||||
[self layoutSettingsView];
|
||||
}
|
||||
|
||||
- (void)switchToAllSettings{
|
||||
[self forceRestoreHeightTemporarilyForSettingStackParentView];
|
||||
currentSettingsMenuMode = AllSettings;
|
||||
for(UIView* view in _parentStack.subviews){
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
[_parentStack removeFromSuperview];
|
||||
[self initParentStack];
|
||||
[self layoutSections];
|
||||
[self updateTheme];
|
||||
@@ -1065,7 +1088,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
Settings *currentSettings = [dataMan retrieveSettings];
|
||||
currentSettings.settingsMenuMode = [NSNumber numberWithInteger:currentSettingsMenuMode];
|
||||
[dataMan saveData];
|
||||
|
||||
[self layoutSettingsView];
|
||||
}
|
||||
|
||||
- (void)enterRemoveSettingItemMode{
|
||||
@@ -1123,6 +1146,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
- (void)viewDidLoad {
|
||||
//[self updateTheme];
|
||||
settingStackWillBeRelocatedToLowestPosition = false;
|
||||
hiddenStacks = [[NSMutableSet alloc] init];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"];
|
||||
|
||||
@@ -1603,22 +1627,38 @@ BOOL isCustomResolution(CGSize res) {
|
||||
bool isNativeTouch = sender.selectedSegmentIndex == NativeTouch;
|
||||
//bool asyncNativeTouchEnabled = [self.asyncNativeTouchPrioritySelector selectedSegmentIndex] != AsyncNativeTouchOff;
|
||||
self.enableOswSwitchStack.hidden = !isNativeTouch;
|
||||
[self setHidden:!isNativeTouch forStack:self.pointerVelocityDividerStack];
|
||||
|
||||
// [self.asyncNativeTouchPrioritySelector setEnabled:![self showOswSelector]]; // this selector stay aligned with oscSelector
|
||||
[self.touchMoveEventIntervalSlider setEnabled: isNativeTouch];
|
||||
[self touchMoveEventIntervalSliderMoved:self.touchMoveEventIntervalSlider];
|
||||
self.pointerVelocityDividerStack.hidden = !isNativeTouch;
|
||||
self.pointerVelocityFactorStack.hidden = !isNativeTouch;
|
||||
self.mousePointerVelocityStack.hidden = !(sender.selectedSegmentIndex == RelativeTouch);
|
||||
[self setHidden:!isNativeTouch forStack:self.pointerVelocityDividerStack];
|
||||
[self setHidden:!isNativeTouch forStack:self.pointerVelocityFactorStack];
|
||||
|
||||
[self setHidden:!(sender.selectedSegmentIndex == RelativeTouch) forStack:self.mousePointerVelocityStack];
|
||||
[self setHidden:![self isNotNativeTouchOnly] forStack:self.onScreenWidgetStack];
|
||||
[self setHidden:![self isNotNativeTouchOnly] forStack:self.swapAbaxyStack];
|
||||
|
||||
self.onScreenWidgetStack.hidden = ![self isNotNativeTouchOnly];
|
||||
self.swapAbaxyStack.hidden = ![self isNotNativeTouchOnly];
|
||||
|
||||
[touchControlSection updateViewForFoldState];
|
||||
}
|
||||
|
||||
- (void)setHidden:(BOOL)hidden forStack:(UIStackView* )stack{
|
||||
// CGFloat previousSpacing = stack.spacing;
|
||||
if(hidden){
|
||||
stack.hidden = YES;
|
||||
[hiddenStacks addObject:stack];
|
||||
}
|
||||
else{
|
||||
stack.hidden = NO;
|
||||
[hiddenStacks removeObject:stack];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enableOswForNativeTouchSwitchFlipped:(UISwitch *)sender{
|
||||
self.onScreenWidgetStack.hidden = !sender.isOn;
|
||||
self.swapAbaxyStack.hidden = !sender.isOn;
|
||||
//self.onScreenWidgetStack.hidden = !sender.isOn;
|
||||
[self setHidden:!sender.isOn forStack:_onScreenWidgetStack];
|
||||
[self setHidden:!sender.isOn forStack:_swapAbaxyStack];
|
||||
//self.swapAbaxyStack.hidden = !sender.isOn;
|
||||
[touchControlSection updateViewForFoldState];
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objc public class ToolBoxViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
@objc protocol ToolBoxSpecialEntryDelegate: NSObjectProtocol {
|
||||
@objc optional func openWidgetLayoutTool()
|
||||
@objc optional func switchWidgetProfile()
|
||||
}
|
||||
|
||||
|
||||
@objc public class ToolBoxViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
@objc weak var specialEntryDelegate: ToolBoxSpecialEntryDelegate?
|
||||
public let tableView = UITableView()
|
||||
private let addButton = UIButton(type: .system)
|
||||
|
||||
Reference in new issue
Block a user