Przeglądaj źródła

Hide the outline views during rotation and make sure they match up with the underlying tracked view following rotation.

Previously, the outline views would get positioned incorrectly after rotation.
Ryan Olson 12 lat temu
rodzic
commit
08982132ea

+ 26 - 0
Classes/Explorer Toolbar/FLEXExplorerViewController.m

@@ -175,6 +175,32 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     return supportedOrientations;
 }
 
+- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+{
+    for (UIView *outlineView in [self.outlineViewsForVisibleViews allValues]) {
+        outlineView.hidden = YES;
+    }
+    self.selectedViewOverlay.hidden = YES;
+}
+
+- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
+{
+    for (UIView *view in self.viewsAtTapPoint) {
+        NSValue *key = [NSValue valueWithNonretainedObject:view];
+        UIView *outlineView = self.outlineViewsForVisibleViews[key];
+        outlineView.frame = [self.view convertRect:view.bounds fromView:view];
+        if (self.currentMode == FLEXExplorerModeSelect) {
+            outlineView.hidden = NO;
+        }
+    }
+    
+    if (self.selectedView) {
+        self.selectedViewOverlay.frame = [self.view convertRect:self.selectedView.bounds fromView:self.selectedView];
+        self.selectedViewOverlay.hidden = NO;
+    }
+}
+
+
 #pragma mark - Setter Overrides
 
 - (void)setSelectedView:(UIView *)selectedView