Tanner Bennett лет назад: 6
Родитель
Сommit
09ff0482df

+ 13 - 1
Classes/Core/Controllers/FLEXTableViewController.m

@@ -32,6 +32,8 @@ CGFloat const kFLEXDebounceForExpensiveIO = 0.5;
 
 @property (nonatomic) BOOL hasAppeared;
 @property (nonatomic, readonly) UIView *tableHeaderViewContainer;
+
+@property (nonatomic, readonly) BOOL manuallyDeactivateSearchOnDisappear;
 @end
 
 @implementation FLEXTableViewController
@@ -60,6 +62,9 @@ CGFloat const kFLEXDebounceForExpensiveIO = 0.5;
         _searchBarDebounceInterval = kFLEXDebounceFast;
         _showSearchBarInitially = YES;
         _style = style;
+        _manuallyDeactivateSearchOnDisappear = ({
+            NSProcessInfo.processInfo.operatingSystemVersion.majorVersion < 11;
+        });
     }
     
     return self;
@@ -264,6 +269,14 @@ CGFloat const kFLEXDebounceForExpensiveIO = 0.5;
     self.didInitiallyRevealSearchBar = YES;
 }
 
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    
+    if (self.manuallyDeactivateSearchOnDisappear && self.searchController.isActive) {
+        self.searchController.active = NO;
+    }
+}
+
 - (void)didMoveToParentViewController:(UIViewController *)parent {
     [super didMoveToParentViewController:parent];
     // Reset this since we are re-appearing under a new
@@ -318,7 +331,6 @@ CGFloat const kFLEXDebounceForExpensiveIO = 0.5;
         self.carousel.frame = FLEXRectSetHeight(
             self.carousel.frame, self.carousel.intrinsicContentSize.height
         );
-        self.carousel.frame = FLEXRectSetY(self.carousel.frame, 0);
     }
     
     self.tableView.tableHeaderView = self.tableView.tableHeaderView;

+ 3 - 1
Classes/Core/Views/Carousel/FLEXCarouselCell.m

@@ -25,8 +25,10 @@
         _selectionIndicatorStripe = [UIView new];
 
         self.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
-        self.titleLabel.adjustsFontForContentSizeCategory = YES;
         self.selectionIndicatorStripe.backgroundColor = self.tintColor;
+        if (@available(iOS 10, *)) {
+            self.titleLabel.adjustsFontForContentSizeCategory = YES;
+        }
 
         [self.contentView addSubview:self.titleLabel];
         [self.contentView addSubview:self.selectionIndicatorStripe];

+ 8 - 1
Classes/GlobalStateExplorers/Globals/FLEXGlobalsViewController.m

@@ -28,6 +28,7 @@
 @property (nonatomic, copy) NSArray<FLEXGlobalsSection *> *sections;
 /// Every section in the table view, regardless of whether or not a section is empty.
 @property (nonatomic, readonly) NSArray<FLEXGlobalsSection *> *allSections;
+@property (nonatomic, readonly) BOOL manuallyDeselectOnAppear;
 @end
 
 @implementation FLEXGlobalsViewController
@@ -169,17 +170,23 @@
         NSString *title = [[self class] globalsTitleForSection:FLEXGlobalsSectionCustom];
         FLEXGlobalsSection *custom = [FLEXGlobalsSection
             title:title
-            rows:[FLEXManager sharedManager].userGlobalEntries
+            rows:FLEXManager.sharedManager.userGlobalEntries
         ];
         _allSections = [_allSections arrayByAddingObject:custom];
     }
     self.sections = self.allSections;
+    
+    _manuallyDeselectOnAppear = NSProcessInfo.processInfo.operatingSystemVersion.majorVersion < 10;
 }
 
 - (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
     
     [self disableToolbar];
+    
+    if (self.manuallyDeselectOnAppear) {
+        [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
+    }
 }
 
 

+ 6 - 8
Classes/GlobalStateExplorers/RuntimeBrowser/TBKeyPathSearchController.m

@@ -294,12 +294,8 @@
 
 #pragma mark UITableViewDataSource
 
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
-    return self.filteredClasses.count ?: 1;
-}
-
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return self.filteredClasses.count ? 1 : self.bundlesOrClasses.count;
+    return self.filteredClasses.count ?: self.bundlesOrClasses.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -318,7 +314,7 @@
     }
     // One row per section
     else if (self.filteredClasses.count) {
-        NSArray<FLEXMethod *> *methods = self.classesToMethods[indexPath.section];
+        NSArray<FLEXMethod *> *methods = self.classesToMethods[indexPath.row];
         NSMutableString *summary = [NSMutableString new];
         [methods enumerateObjectsUsingBlock:^(FLEXMethod *method, NSUInteger idx, BOOL *stop) {
             NSString *format = nil;
@@ -336,8 +332,10 @@
         }];
 
         cell.accessoryType        = UITableViewCellAccessoryDisclosureIndicator;
-        cell.textLabel.text       = self.filteredClasses[indexPath.section];
-        cell.detailTextLabel.text = summary.length ? summary : nil;
+        cell.textLabel.text       = self.filteredClasses[indexPath.row];
+        if (@available(iOS 10, *)) {
+            cell.detailTextLabel.text = summary.length ? summary : nil;
+        }
 
     }
     else {

+ 6 - 0
Classes/ObjectExplorers/Sections/Shortcuts/FLEXShortcutsFactory+Defaults.m

@@ -73,6 +73,9 @@
     }
 
     ivars = @[@"_targetActions", @"_gestureRecognizers"];
+    
+    // Property was added in iOS 10 but we want it on iOS 9 too
+    FLEXRuntimeUtilityTryAddObjectProperty(9, allTargets, UIControl.class, NSArray, PropertyKey(ReadOnly));
 
     // UIControl
     self.append.ivars(ivars).methods(methods).properties(@[
@@ -163,6 +166,9 @@
 @implementation FLEXShortcutsFactory (Activities)
 
 + (void)load { FLEX_EXIT_IF_TESTING()
+    // Property was added in iOS 10 but we want it on iOS 9 too
+    FLEXRuntimeUtilityTryAddNonatomicProperty(9, item, UIActivityItemProvider.class, id, PropertyKey(ReadOnly));
+    
     self.append.properties(@[
         @"item", @"placeholderItem", @"activityType"
     ]).forClass(UIActivityItemProvider.class);