Преглед изворни кода

Improve status bar behavior across FLEX.

Instead of trying to hide the status bar everywhere, move the status bar back above FLEX’s window when we present a modal view controller. This allows tapping to scroll to top.
Ryan Olson пре 12 година
родитељ
комит
86566e95a9

+ 0 - 5
Classes/Editing/FLEXFieldEditorViewController.m

@@ -68,11 +68,6 @@
     self.scrollView.scrollIndicatorInsets = scrollInsets;
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 - (void)viewDidLoad
 {
     [super viewDidLoad];

+ 13 - 2
Classes/Explorer Toolbar/FLEXExplorerViewController.m

@@ -410,9 +410,8 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 
 - (NSArray *)allWindows
 {
-    NSString *statusBarString = [NSString stringWithFormat:@"%@arWindow", @"_statusB"];
-    UIWindow *statusWindow = [[UIApplication sharedApplication] valueForKey:statusBarString];
     NSMutableArray *windows = [[[UIApplication sharedApplication] windows] mutableCopy];
+    UIWindow *statusWindow = [self statusWindow];
     if (statusWindow) {
         // The windows are ordered back to front, so default to inserting the status bar at the end.
         // However, it there are windows at status bar level, insert the status bar before them.
@@ -428,6 +427,12 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     return windows;
 }
 
+- (UIWindow *)statusWindow
+{
+    NSString *statusBarString = [NSString stringWithFormat:@"%@arWindow", @"_statusB"];
+    return [[UIApplication sharedApplication] valueForKey:statusBarString];
+}
+
 - (void)moveButtonTapped:(FLEXToolbarItem *)sender
 {
     if (self.currentMode == FLEXExplorerModeMove) {
@@ -794,6 +799,9 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     // Make our window key to correctly handle input.
     [self.view.window makeKeyWindow];
     
+    // Move the status bar on top of FLEX so we can get scroll to top behavior for taps.
+    [[self statusWindow] setWindowLevel:self.view.window.windowLevel + 1.0];
+    
     // Show the view controller.
     [self presentViewController:viewController animated:animated completion:completion];
 }
@@ -804,6 +812,9 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     
     self.previousKeyWindow = nil;
     
+    // Restore the status bar window's normal window level.
+    // We want it above FLEX while a modal is presented for scroll to top, but below FLEX otherwise for exploration.
+    [[self statusWindow] setWindowLevel:UIWindowLevelStatusBar];
     
     [self dismissViewControllerAnimated:animated completion:completion];
 }

+ 0 - 5
Classes/Global State Explorers/FLEXClassesTableViewController.m

@@ -33,11 +33,6 @@
     self.tableView.tableHeaderView = self.searchBar;
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 - (void)setBinaryImageName:(NSString *)binaryImageName
 {
     if (![_binaryImageName isEqual:binaryImageName]) {

+ 0 - 4
Classes/Global State Explorers/FLEXFileBrowserTableViewController.m

@@ -59,10 +59,6 @@
     return self;
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
 
 #pragma mark - Table view data source
 

+ 0 - 5
Classes/Global State Explorers/FLEXGlobalsTableViewController.m

@@ -46,11 +46,6 @@ typedef NS_ENUM(NSUInteger, FLEXGlobalsRow) {
     return self;
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 - (void)viewDidLoad
 {
     [super viewDidLoad];

+ 0 - 5
Classes/Global State Explorers/FLEXInstancesTableViewController.m

@@ -37,11 +37,6 @@
     return instancesViewController;
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 
 #pragma mark - Table View Data Source
 

+ 0 - 5
Classes/Global State Explorers/FLEXLibrariesTableViewController.m

@@ -42,11 +42,6 @@
     self.tableView.tableHeaderView = self.searchBar;
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 
 #pragma mark - Binary Images
 

+ 0 - 5
Classes/Global State Explorers/FLEXLiveObjectsTableViewController.m

@@ -44,11 +44,6 @@ static const NSInteger kFLEXLiveObjectsSortByCountIndex = 1;
     [self reloadTableData];
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 - (NSArray *)allClassNames
 {
     return [self.instanceCountsForClassNames allKeys];

+ 0 - 5
Classes/Global State Explorers/FLEXWebViewController.m

@@ -64,11 +64,6 @@
     }
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 - (void)copyButtonTapped:(id)sender
 {
     [[UIPasteboard generalPasteboard] setString:self.originalText];

+ 0 - 5
Classes/Object Explorers/FLEXObjectExplorerViewController.m

@@ -101,11 +101,6 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
     [self.tableView reloadRowsAtIndexPaths:visibleIndexPaths withRowAnimation:UITableViewRowAnimationNone];
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
 {
     [self.searchBar endEditing:YES];

+ 0 - 5
Classes/View Hierarchy/FLEXHierarchyTableViewController.m

@@ -80,11 +80,6 @@ static const NSInteger kFLEXHierarchyScopeFullHierarchyIndex = 1;
     [self trySelectCellForSelectedViewWithScrollPosition:UITableViewScrollPositionMiddle];
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 
 #pragma mark Selection and Filtering Helpers
 

+ 0 - 5
Classes/View Hierarchy/FLEXViewSnapshotViewController.m

@@ -78,11 +78,6 @@
     self.scrollView.contentInset = UIEdgeInsetsMake(verticalInset, horizontalInset, verticalInset, horizontalInset);
 }
 
-- (BOOL)prefersStatusBarHidden
-{
-    return YES;
-}
-
 - (void)copyButtonPressed:(id)sender
 {
     [[UIPasteboard generalPasteboard] setImage:self.image];