speed up settings menu loading

This commit is contained in:
TrueZhuanjia committed 2025-06-05 16:03:01 +08:00
1 parent 01e379eefe
commit b036e01afc
5 files changed
+31 -10

No files matched your search

+3 -3
View File
@@ -54,7 +54,7 @@
<!--Settings View Controller--> <!--Settings View Controller-->
<scene sceneID="tWo-uo-hHg"> <scene sceneID="tWo-uo-hHg">
<objects> <objects>
<viewController id="BsV-3c-455" customClass="SettingsViewController" sceneMemberID="viewController"> <viewController storyboardIdentifier="settingsViewController" id="BsV-3c-455" customClass="SettingsViewController" sceneMemberID="viewController">
<layoutGuides> <layoutGuides>
<viewControllerLayoutGuide type="top" id="ef6-uF-5Hh"/> <viewControllerLayoutGuide type="top" id="ef6-uF-5Hh"/>
<viewControllerLayoutGuide type="bottom" id="XvO-F3-j4u"/> <viewControllerLayoutGuide type="bottom" id="XvO-F3-j4u"/>
@@ -1268,13 +1268,13 @@ ICAgICAgICAgICAgICA
<image name="SquaresArrowUp" width="40" height="40"/> <image name="SquaresArrowUp" width="40" height="40"/>
<image name="Trash" width="40" height="40"/> <image name="Trash" width="40" height="40"/>
<systemColor name="secondaryLabelColor"> <systemColor name="secondaryLabelColor">
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="systemBrownColor"> <systemColor name="systemBrownColor">
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
</resources> </resources>
</document> </document>
+4 -2
View File
@@ -231,12 +231,14 @@
- (void)addSubStackView:(UIStackView *)stackView { - (void)addSubStackView:(UIStackView *)stackView {
[CATransaction begin]; [CATransaction begin];
[CATransaction setDisableActions:YES]; [CATransaction setDisableActions:YES];
[UIView performWithoutAnimation:^{
if (![_subStackViews containsObject:stackView]) { if (![_subStackViews containsObject:stackView]) {
[_subStackViews addObject:stackView]; [_subStackViews addObject:stackView];
[_rootStackView addArrangedSubview:stackView]; [_rootStackView addArrangedSubview:stackView];
[_rootStackView layoutIfNeeded]; //[_rootStackView layoutIfNeeded];
[self updateLayout]; //[self updateLayout];
} }
}];
[CATransaction commit]; [CATransaction commit];
// NSLog(@"rootStack height2: %f", _rootStackView.frame.size.height); // NSLog(@"rootStack height2: %f", _rootStackView.frame.size.height);
} }
@@ -1531,6 +1531,14 @@ static NSMutableSet* hostList;
// SettingsViewController* settingsViewController = (SettingsViewController*)[self.revealViewController rearViewController]; // SettingsViewController* settingsViewController = (SettingsViewController*)[self.revealViewController rearViewController];
// [settingsViewController updateResolutionTable]; // [settingsViewController updateResolutionTable];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
SettingsViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"settingsViewController"];
// 强制加载视图
__unused UIView *view = viewController.view;
} }
-(void)viewDidLayoutSubviews{ -(void)viewDidLayoutSubviews{
@@ -631,6 +631,7 @@ static CGFloat scaledValue( CGFloat v1, CGFloat min2, CGFloat max2, CGFloat min1
SWContextTransitionObject *_rearTransitioningController; SWContextTransitionObject *_rearTransitioningController;
SWContextTransitionObject *_frontTransitioningController; SWContextTransitionObject *_frontTransitioningController;
SWContextTransitionObject *_rightTransitioningController; SWContextTransitionObject *_rightTransitioningController;
CGFloat timeStamp;
} }
@end @end
@@ -1263,6 +1264,7 @@ const int FrontViewPositionNone = 0xff;
- (IBAction)revealToggle:(id)sender - (IBAction)revealToggle:(id)sender
{ {
timeStamp = CACurrentMediaTime();
[self revealToggleAnimated:YES]; [self revealToggleAnimated:YES];
} }
@@ -1907,9 +1909,11 @@ const int FrontViewPositionNone = 0xff;
deploymentCompletion(); deploymentCompletion();
if ( positionIsChanging ) if ( positionIsChanging )
{ {
if ( [self->_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] ) if ( [self->_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] ){
NSLog(@"expansion: %f", CACurrentMediaTime() - self->timeStamp);
[self->_delegate revealController:self didMoveToPosition:newPosition]; [self->_delegate revealController:self didMoveToPosition:newPosition];
} }
}
}; };
return completion; return completion;
@@ -308,7 +308,7 @@ BOOL isCustomResolution(CGSize res) {
} }
- (void)viewDidAppear:(BOOL)animated{ - (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated]; [super viewDidAppear:NO];
[self updateResolutionTable]; [self updateResolutionTable];
//[self updateTheme]; //[self updateTheme];
NSLog(@"Resolution table updated"); NSLog(@"Resolution table updated");
@@ -334,7 +334,7 @@ BOOL isCustomResolution(CGSize res) {
- (void)viewDidDisappear:(BOOL)animated{ - (void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated]; [super viewDidDisappear:NO];
[[NSNotificationCenter defaultCenter] postNotificationName:@"SettingsViewClosedNotification" object:self]; // notify other view that settings view just closed [[NSNotificationCenter defaultCenter] postNotificationName:@"SettingsViewClosedNotification" object:self]; // notify other view that settings view just closed
} }
@@ -415,6 +415,7 @@ BOOL isCustomResolution(CGSize res) {
} }
- (void)layoutSections{ - (void)layoutSections{
NSLog(@"preLoad Log test");
MenuSectionView *videoSection = [[MenuSectionView alloc] init]; MenuSectionView *videoSection = [[MenuSectionView alloc] init];
videoSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Video"]; videoSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Video"];
if (@available(iOS 13.0, *)) { if (@available(iOS 13.0, *)) {
@@ -823,6 +824,9 @@ BOOL isCustomResolution(CGSize res) {
- (void)viewDidLoad { - (void)viewDidLoad {
//[self updateTheme]; //[self updateTheme];
[UIView performWithoutAnimation:^{
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"]; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"];
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
@@ -870,17 +874,19 @@ BOOL isCustomResolution(CGSize res) {
currentSettingsMenuMode = currentSettings.settingsMenuMode.intValue; currentSettingsMenuMode = currentSettings.settingsMenuMode.intValue;
[self loadFavoriteSettingStackIdentifiers]; [self loadFavoriteSettingStackIdentifiers];
if(currentSettings.settingsMenuMode.intValue == FavoriteSettings) [self switchToFavoriteSettings];
/*
switch (currentSettingsMenuMode) { switch (currentSettingsMenuMode) {
case FavoriteSettings: case FavoriteSettings:
[self switchToFavoriteSettings]; [self switchToFavoriteSettings];
break; break;
case AllSettings: case AllSettings:
[self switchToAllSettings]; //[self switchToAllSettings];
break; break;
default: default:
break; break;
} }
*/
// Ensure we pick a bitrate that falls exactly onto a slider notch // Ensure we pick a bitrate that falls exactly onto a slider notch
@@ -1097,6 +1103,7 @@ BOOL isCustomResolution(CGSize res) {
[self.externalDisplayModeSelector setSelectedSegmentIndex:currentSettings.externalDisplayMode.integerValue]; [self.externalDisplayModeSelector setSelectedSegmentIndex:currentSettings.externalDisplayMode.integerValue];
[self.localMousePointerModeSelector setSelectedSegmentIndex:currentSettings.localMousePointerMode.integerValue]; [self.localMousePointerModeSelector setSelectedSegmentIndex:currentSettings.localMousePointerMode.integerValue];
}];
} }
- (void)slideToSettingsScreenEdgeChanged{ - (void)slideToSettingsScreenEdgeChanged{