Kaynağa Gözat

Add comment explaining why we add the frame property to UIView at runtime.

Ryan Olson 12 yıl önce
ebeveyn
işleme
6a7d8cea5c

+ 2 - 0
Classes/Object Explorers/FLEXViewExplorerViewController.m

@@ -88,6 +88,8 @@ typedef NS_ENUM(NSUInteger, FLEXViewExplorerRow) {
     if ([rowCookie isEqual:@(FLEXViewExplorerRowViewController)]) {
     if ([rowCookie isEqual:@(FLEXViewExplorerRowViewController)]) {
         drillInViewController = [FLEXObjectExplorerFactory explorerViewControllerForObject:[FLEXUtility viewControllerForView:self.viewToExplore]];
         drillInViewController = [FLEXObjectExplorerFactory explorerViewControllerForObject:[FLEXUtility viewControllerForView:self.viewToExplore]];
     } else if ([rowCookie isEqual:@(FLEXViewExplorerRowFrame)]) {
     } else if ([rowCookie isEqual:@(FLEXViewExplorerRowFrame)]) {
+        // A quirk of UIView: frame is not actually a property from the perspective of the runtime.
+        // We add the property to the class at runtime if it hasn't been added yet.
         [FLEXRuntimeUtility addFramePropertyToUIViewIfNeeded];
         [FLEXRuntimeUtility addFramePropertyToUIViewIfNeeded];
         objc_property_t frameProperty = class_getProperty([UIView class], "frame");
         objc_property_t frameProperty = class_getProperty([UIView class], "frame");
         drillInViewController = [[FLEXPropertyEditorViewController alloc] initWithTarget:self.viewToExplore property:frameProperty];
         drillInViewController = [[FLEXPropertyEditorViewController alloc] initWithTarget:self.viewToExplore property:frameProperty];