diff --git a/AsyncDisplayKit.xcodeproj/project.pbxproj b/AsyncDisplayKit.xcodeproj/project.pbxproj index 9a39843b..d33ac50f 100644 --- a/AsyncDisplayKit.xcodeproj/project.pbxproj +++ b/AsyncDisplayKit.xcodeproj/project.pbxproj @@ -278,6 +278,10 @@ 76C0782D1C9F459C00E37AB1 /* ASLayoutableInspectorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 76C0782A1C9F459C00E37AB1 /* ASLayoutableInspectorNode.h */; }; 76C0782E1C9F459C00E37AB1 /* ASLayoutableInspectorNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 76C0782B1C9F459C00E37AB1 /* ASLayoutableInspectorNode.m */; }; 76C0782F1C9F459C00E37AB1 /* ASLayoutableInspectorNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 76C0782B1C9F459C00E37AB1 /* ASLayoutableInspectorNode.m */; }; + 76E5FDFA1CA8EF12000164C0 /* ASLayoutableInspectorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 76E5FDF81CA8EF12000164C0 /* ASLayoutableInspectorCell.h */; }; + 76E5FDFB1CA8EF12000164C0 /* ASLayoutableInspectorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 76E5FDF81CA8EF12000164C0 /* ASLayoutableInspectorCell.h */; }; + 76E5FDFC1CA8EF12000164C0 /* ASLayoutableInspectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76E5FDF91CA8EF12000164C0 /* ASLayoutableInspectorCell.m */; }; + 76E5FDFD1CA8EF12000164C0 /* ASLayoutableInspectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76E5FDF91CA8EF12000164C0 /* ASLayoutableInspectorCell.m */; }; 7A06A73A1C35F08800FE8DAA /* ASRelativeLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A06A7381C35F08800FE8DAA /* ASRelativeLayoutSpec.mm */; }; 7A06A73B1C35F08800FE8DAA /* ASRelativeLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A06A7391C35F08800FE8DAA /* ASRelativeLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7AB338661C55B3420055FDE8 /* ASRelativeLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A06A7381C35F08800FE8DAA /* ASRelativeLayoutSpec.mm */; }; @@ -762,6 +766,8 @@ 76C078251C9F455E00E37AB1 /* ASLayoutSpec+Debug.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ASLayoutSpec+Debug.m"; sourceTree = ""; }; 76C0782A1C9F459C00E37AB1 /* ASLayoutableInspectorNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutableInspectorNode.h; sourceTree = ""; }; 76C0782B1C9F459C00E37AB1 /* ASLayoutableInspectorNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLayoutableInspectorNode.m; sourceTree = ""; }; + 76E5FDF81CA8EF12000164C0 /* ASLayoutableInspectorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutableInspectorCell.h; sourceTree = ""; }; + 76E5FDF91CA8EF12000164C0 /* ASLayoutableInspectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLayoutableInspectorCell.m; sourceTree = ""; }; 7A06A7381C35F08800FE8DAA /* ASRelativeLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASRelativeLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASRelativeLayoutSpec.mm; sourceTree = ""; }; 7A06A7391C35F08800FE8DAA /* ASRelativeLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASRelativeLayoutSpec.h; path = AsyncDisplayKit/Layout/ASRelativeLayoutSpec.h; sourceTree = ""; }; 7AB338681C55B97B0055FDE8 /* ASRelativeLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRelativeLayoutSpecSnapshotTests.mm; sourceTree = ""; }; @@ -1058,6 +1064,8 @@ 76C0782B1C9F459C00E37AB1 /* ASLayoutableInspectorNode.m */, 76A64B691CA8CD4900967B8F /* ASLayoutableInspectorCell.h */, 76A64B6A1CA8CD4900967B8F /* ASLayoutableInspectorCell.m */, + 76E5FDF81CA8EF12000164C0 /* ASLayoutableInspectorCell.h */, + 76E5FDF91CA8EF12000164C0 /* ASLayoutableInspectorCell.m */, 764D83D21C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h */, 764D83D31C8EA515009B4FB8 /* AsyncDisplayKit+Debug.m */, DB55C2651C641AE4004EDCF5 /* ASContextTransitioning.h */, @@ -1452,6 +1460,7 @@ 257754A51BEE44CD00737CA5 /* ASTextKitRenderer.h in Headers */, 464052201A3F83C40061C0BA /* ASDataController.h in Headers */, 76A64B6B1CA8CD4900967B8F /* ASLayoutableInspectorCell.h in Headers */, + 76E5FDFA1CA8EF12000164C0 /* ASLayoutableInspectorCell.h in Headers */, 05A6D05A19D0EB64002DD95E /* ASDealloc2MainObject.h in Headers */, ACF6ED201B17843500DA7C62 /* ASDimension.h in Headers */, 058D0A78195D05F900B7D73C /* ASDisplayNode+DebugTiming.h in Headers */, @@ -1616,6 +1625,7 @@ 254C6B7F1BF94DF4003EC431 /* ASTextKitTruncating.h in Headers */, 7AB338671C55B3460055FDE8 /* ASRelativeLayoutSpec.h in Headers */, 76A64B6C1CA8CD4900967B8F /* ASLayoutableInspectorCell.h in Headers */, + 76E5FDFB1CA8EF12000164C0 /* ASLayoutableInspectorCell.h in Headers */, B35062021B010EFD0018CF92 /* ASImageNode.h in Headers */, B350621F1B010EFD0018CF92 /* ASImageProtocols.h in Headers */, 430E7C901B4C23F100697A4C /* ASIndexPath.h in Headers */, @@ -1936,6 +1946,7 @@ DEC146B81C37A16A004A0EE7 /* ASCollectionInternal.m in Sources */, 058D0A15195D050800B7D73C /* ASDisplayNodeExtras.mm in Sources */, 76A64B6D1CA8CD4900967B8F /* ASLayoutableInspectorCell.m in Sources */, + 76E5FDFC1CA8EF12000164C0 /* ASLayoutableInspectorCell.m in Sources */, AEEC47E21C20C2DD00EC1693 /* ASVideoNode.mm in Sources */, 0587F9BE1A7309ED00AFF0BA /* ASEditableTextNode.mm in Sources */, 464052231A3F83C40061C0BA /* ASFlowLayoutController.mm in Sources */, @@ -2053,6 +2064,7 @@ 92DD2FE71BF4D0850074C9DD /* ASMapNode.mm in Sources */, 636EA1A51C7FF4EF00EE152F /* ASDefaultPlayButton.m in Sources */, 76A64B6E1CA8CD4900967B8F /* ASLayoutableInspectorCell.m in Sources */, + 76E5FDFD1CA8EF12000164C0 /* ASLayoutableInspectorCell.m in Sources */, 9B92C8861BC2EB7600EE46B2 /* ASCollectionViewFlowLayoutInspector.m in Sources */, 9B92C8851BC2EB6E00EE46B2 /* ASCollectionDataController.mm in Sources */, B350623D1B010EFD0018CF92 /* _ASAsyncTransaction.mm in Sources */, diff --git a/AsyncDisplayKit/ASLayoutableInspectorCell.h b/AsyncDisplayKit/ASLayoutableInspectorCell.h index 4413d628..f190b8cf 100644 --- a/AsyncDisplayKit/ASLayoutableInspectorCell.h +++ b/AsyncDisplayKit/ASLayoutableInspectorCell.h @@ -12,6 +12,7 @@ typedef NS_ENUM(NSInteger, ASLayoutablePropertyType) { ASLayoutablePropertyFlexGrow = 0, ASLayoutablePropertyFlexShrink, ASLayoutablePropertyAlignSelf, + ASLayoutablePropertyFlexBasis, ASLayoutablePropertySpacingBefore, ASLayoutablePropertySpacingAfter, ASLayoutablePropertyAscender, @@ -24,3 +25,4 @@ typedef NS_ENUM(NSInteger, ASLayoutablePropertyType) { - (instancetype)initWithProperty:(ASLayoutablePropertyType)property layoutableToEdit:(id)layoutable NS_DESIGNATED_INITIALIZER; @end + diff --git a/AsyncDisplayKit/ASLayoutableInspectorCell.m b/AsyncDisplayKit/ASLayoutableInspectorCell.m index d9e7c29a..56b1958b 100644 --- a/AsyncDisplayKit/ASLayoutableInspectorCell.m +++ b/AsyncDisplayKit/ASLayoutableInspectorCell.m @@ -14,6 +14,20 @@ typedef NS_ENUM(NSInteger, CellDataType) { CellDataTypeFloat, }; +__weak static ASLayoutableInspectorCell *__currentlyOpenedCell = nil; + +@protocol InspectorCellEditingBubbleProtocol +- (void)valueChangedToIndex:(NSUInteger)index; +@end + +@interface ASLayoutableInspectorCellEditingBubble : ASDisplayNode +@property (nonatomic, strong, readwrite) id delegate; +- (instancetype)initWithOptions:(NSArray *)options; +@end + +@interface ASLayoutableInspectorCell () +@end + @implementation ASLayoutableInspectorCell { ASLayoutablePropertyType _propertyType; @@ -22,6 +36,9 @@ typedef NS_ENUM(NSInteger, CellDataType) { ASButtonNode *_buttonNode; ASTextNode *_textNode; + ASTextNode *_textNode2; + + ASLayoutableInspectorCellEditingBubble *_textBubble; } #pragma mark - Lifecycle @@ -44,10 +61,38 @@ typedef NS_ENUM(NSInteger, CellDataType) { _textNode = [[ASTextNode alloc] init]; _textNode.attributedString = [ASLayoutableInspectorCell propertyValueAttributedStringForProperty:property withLayoutable:layoutable]; + _textNode2 = [[ASTextNode alloc] init]; + _textNode2.attributedString = [ASLayoutableInspectorCell propertyValueDetailAttributedStringForProperty:property withLayoutable:layoutable]; + } return self; } +- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize +{ + ASStackLayoutSpec *horizontalSpec = [ASStackLayoutSpec horizontalStackLayoutSpec]; + horizontalSpec.children = @[_buttonNode, _textNode]; + horizontalSpec.flexGrow = YES; + horizontalSpec.alignItems = ASStackLayoutAlignItemsCenter; + horizontalSpec.justifyContent = ASStackLayoutJustifyContentSpaceBetween; + + ASLayoutSpec *childSpec; + if (_textBubble) { + ASStackLayoutSpec *verticalSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; + verticalSpec.children = @[horizontalSpec, _textBubble]; + verticalSpec.spacing = 8; + verticalSpec.flexGrow = YES; + _textBubble.flexGrow = YES; + childSpec = verticalSpec; + } else { + childSpec = horizontalSpec; + } + ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(2, 4, 2, 4) child:childSpec]; + insetSpec.flexGrow = YES; + + return insetSpec; +} + + (NSAttributedString *)propertyValueAttributedStringForProperty:(ASLayoutablePropertyType)property withLayoutable:(id)layoutable { NSString *valueString; @@ -60,7 +105,15 @@ typedef NS_ENUM(NSInteger, CellDataType) { valueString = layoutable.flexShrink ? @"YES" : @"NO"; break; case ASLayoutablePropertyAlignSelf: - valueString = [ASLayoutableInspectorCell alignSelfValueString:layoutable.alignSelf]; + valueString = [ASLayoutableInspectorCell alignSelfEnumValueString:layoutable.alignSelf]; + break; + case ASLayoutablePropertyFlexBasis: + if (layoutable.flexBasis.type && layoutable.flexBasis.value) { // ENUM TYPE + valueString = [NSString stringWithFormat:@"%0.0f %@", layoutable.flexBasis.value, + [ASLayoutableInspectorCell ASRelativeDimensionEnumString:layoutable.alignSelf]]; + } else { + valueString = @"0 pts"; + } break; case ASLayoutablePropertySpacingBefore: valueString = [NSString stringWithFormat:@"%0.0f", layoutable.spacingBefore]; @@ -81,62 +134,96 @@ typedef NS_ENUM(NSInteger, CellDataType) { return [ASLayoutableInspectorCell attributedStringFromString:valueString]; } -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize ++ (NSAttributedString *)propertyValueDetailAttributedStringForProperty:(ASLayoutablePropertyType)property withLayoutable:(id)layoutable { - ASStackLayoutSpec *horizontalSpec = [ASStackLayoutSpec horizontalStackLayoutSpec]; - horizontalSpec.children = @[_buttonNode, _textNode]; - horizontalSpec.flexGrow = YES; - horizontalSpec.alignItems = ASStackLayoutAlignItemsCenter; - horizontalSpec.justifyContent = ASStackLayoutJustifyContentSpaceBetween; + NSString *valueString; - ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(2, 4, 2, 4) child:horizontalSpec]; - - return insetSpec; + switch (property) { + case ASLayoutablePropertyFlexGrow: + case ASLayoutablePropertyFlexShrink: + case ASLayoutablePropertyAlignSelf: + case ASLayoutablePropertyFlexBasis: + case ASLayoutablePropertySpacingBefore: + case ASLayoutablePropertySpacingAfter: + case ASLayoutablePropertyAscender: + case ASLayoutablePropertyDescender: + default: + return nil; + } + return [ASLayoutableInspectorCell attributedStringFromString:valueString]; +} + +- (void)endEditingValue +{ + _textBubble = nil; + __currentlyOpenedCell = nil; + [self setNeedsLayout]; +} + +- (void)beginEditingValueWithOptions:(NSArray *)optionStrings +{ + _textBubble = [[ASLayoutableInspectorCellEditingBubble alloc] initWithOptions:optionStrings]; + _textBubble.delegate = self; + __currentlyOpenedCell = self; + [self setNeedsLayout]; +} + +- (void)valueChangedToIndex:(NSUInteger)index +{ + [_layoutableToEdit setDescender:(CGFloat)index]; + _textNode.attributedString = [ASLayoutableInspectorCell attributedStringFromString:[NSString stringWithFormat:@"%0.0f", _layoutableToEdit.descender]]; + [self setNeedsLayout]; } #pragma mark - gesture handling - (void)buttonTapped:(ASButtonNode *)sender { - NSUInteger currentAlignSelfValue; - NSUInteger nextAlignSelfValue; + BOOL selfIsEditing = (self == __currentlyOpenedCell); + [__currentlyOpenedCell endEditingValue]; + if (selfIsEditing) { + return; + } + +// NSUInteger currentAlignSelfValue; +// NSUInteger nextAlignSelfValue; + CGFloat newValue; switch (_propertyType) { case ASLayoutablePropertyFlexGrow: - if ([self layoutSpec]) { - [[self layoutSpec] setFlexGrow:!sender.isSelected]; - } else if ([self node]) { - [[self node] setFlexGrow:!sender.isSelected]; - } - // update .selected & value + [_layoutableToEdit setFlexGrow:!sender.isSelected]; sender.selected = !sender.selected; _textNode.attributedString = [ASLayoutableInspectorCell attributedStringFromString:sender.selected ? @"YES" : @"NO"]; break; case ASLayoutablePropertyFlexShrink: - if ([self layoutSpec]) { - [[self layoutSpec] setFlexShrink:!sender.isSelected]; - } else if ([self node]) { - [[self node] setFlexGrow:!sender.isSelected]; - } - // update .selected & value + [_layoutableToEdit setFlexShrink:!sender.isSelected]; sender.selected = !sender.selected; _textNode.attributedString = [ASLayoutableInspectorCell attributedStringFromString:sender.selected ? @"YES" : @"NO"]; break; case ASLayoutablePropertyAlignSelf: - if ([self layoutSpec]) { - currentAlignSelfValue = [[self layoutSpec] alignSelf]; - nextAlignSelfValue = (currentAlignSelfValue + 1 <= ASStackLayoutAlignSelfStretch) ? currentAlignSelfValue + 1 : 0; - [[self layoutSpec] setAlignSelf:nextAlignSelfValue]; - - } else if ([self node]) { - currentAlignSelfValue = [[self node] alignSelf]; - nextAlignSelfValue = (currentAlignSelfValue + 1 <= ASStackLayoutAlignSelfStretch) ? currentAlignSelfValue + 1 : 0; - [[self node] setAlignSelf:nextAlignSelfValue]; - } + [self beginEditingValueWithOptions:[ASLayoutableInspectorCell alignSelfEnumStringArray]]; // FIXME: also set selected +// if ([self layoutSpec]) { +// currentAlignSelfValue = [[self layoutSpec] alignSelf]; +// nextAlignSelfValue = (currentAlignSelfValue + 1 <= ASStackLayoutAlignSelfStretch) ? currentAlignSelfValue + 1 : 0; +// [[self layoutSpec] setAlignSelf:nextAlignSelfValue]; +// +// } else if ([self node]) { +// currentAlignSelfValue = [[self node] alignSelf]; +// nextAlignSelfValue = (currentAlignSelfValue + 1 <= ASStackLayoutAlignSelfStretch) ? currentAlignSelfValue + 1 : 0; +// [[self node] setAlignSelf:nextAlignSelfValue]; +// } + break; + case ASLayoutablePropertyDescender: + [self beginEditingValueWithOptions:@[]]; + newValue = 5; + [_layoutableToEdit setDescender:newValue]; + // update .selected & value + sender.selected = !sender.selected; + _textNode.attributedString = [ASLayoutableInspectorCell attributedStringFromString:[NSString stringWithFormat:@"%0.0f", _layoutableToEdit.descender]]; break; default: @@ -145,6 +232,8 @@ typedef NS_ENUM(NSInteger, CellDataType) { [self setNeedsLayout]; } + + #pragma mark - cast layoutableToEdit - (ASDisplayNode *)node @@ -198,6 +287,9 @@ typedef NS_ENUM(NSInteger, CellDataType) { case ASLayoutablePropertyAlignSelf: string = @"AlignSelf"; break; + case ASLayoutablePropertyFlexBasis: + string = @"FlexBasis"; + break; case ASLayoutablePropertySpacingBefore: string = @"SpacingBefore"; break; @@ -226,11 +318,30 @@ typedef NS_ENUM(NSInteger, CellDataType) { @(ASStackLayoutAlignSelfStretch) : @"Stretch"}; } -+ (NSString *)alignSelfValueString:(NSUInteger)type ++ (NSString *)alignSelfEnumValueString:(NSUInteger)type { return [[self class] alignSelfTypeNames][@(type)]; } ++ (NSArray *)alignSelfEnumStringArray +{ + return @[@"ASStackLayoutAlignSelfAuto", + @"ASStackLayoutAlignSelfStart", + @"ASStackLayoutAlignSelfEnd", + @"ASStackLayoutAlignSelfCenter", + @"ASStackLayoutAlignSelfStretch"]; +} + ++ (NSDictionary *)ASRelativeDimensionTypeNames +{ + return @{@(ASRelativeDimensionTypePoints) : @"pts", + @(ASRelativeDimensionTypePercent) : @"%"}; +} + ++ (NSString *)ASRelativeDimensionEnumString:(NSUInteger)type +{ + return [[self class] ASRelativeDimensionTypeNames][@(type)]; +} #pragma mark - formatting helper methods @@ -294,4 +405,60 @@ typedef NS_ENUM(NSInteger, CellDataType) { return [btnImage stretchableImageWithLeftCapWidth:CORNER_RADIUS topCapHeight:CORNER_RADIUS]; } -@end \ No newline at end of file +@end + + + + + +@implementation ASLayoutableInspectorCellEditingBubble +{ + NSMutableArray *_textNodes; +} + +- (instancetype)initWithOptions:(NSArray *)options +{ + self = [super init]; + if (self) { + self.usesImplicitHierarchyManagement = YES; + self.backgroundColor = [UIColor colorWithRed:255/255.0 green:181/255.0 blue:68/255.0 alpha:1]; + + _textNodes = [[NSMutableArray alloc] init]; + for (NSString *optionStr in options) { + ASButtonNode *btn = [[ASButtonNode alloc] init]; + [btn setAttributedTitle:[ASLayoutableInspectorCell attributedStringFromString:optionStr] forState:ASControlStateNormal]; + [btn setAttributedTitle:[ASLayoutableInspectorCell attributedStringFromString:optionStr withTextColor:[UIColor redColor]] + forState:ASControlStateSelected]; + [btn addTarget:self action:@selector(tapped:) forControlEvents:ASControlNodeEventTouchUpInside]; + [_textNodes addObject:btn]; + } + } + return self; +} + +- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize +{ + ASStackLayoutSpec *verticalStackSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; + verticalStackSpec.children = _textNodes; + verticalStackSpec.spacing = 2; + + ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(8, 8, 8, 8) child:verticalStackSpec]; + + return insetSpec; +} + +- (void)tapped:(ASButtonNode *)sender +{ + sender.selected = !sender.selected; + for (ASButtonNode *node in _textNodes) { + if (node != sender) { + node.selected = NO; + } + } + [self.delegate valueChangedToIndex:[_textNodes indexOfObject:sender]]; + [self setNeedsLayout]; +} + +@end + + diff --git a/AsyncDisplayKit/ASLayoutableInspectorNode.m b/AsyncDisplayKit/ASLayoutableInspectorNode.m index 37bf80b6..a2fe0fc9 100644 --- a/AsyncDisplayKit/ASLayoutableInspectorNode.m +++ b/AsyncDisplayKit/ASLayoutableInspectorNode.m @@ -52,6 +52,7 @@ { [super didLoad]; _tableNode.view.backgroundColor = [UIColor colorWithRed:40/255.0 green:43/255.0 blue:53/255.0 alpha:1]; + _tableNode.view.separatorStyle = UITableViewCellSeparatorStyleNone; _tableNode.view.allowsSelection = NO; } @@ -61,21 +62,22 @@ _tableNode.frame = self.bounds; } -//- (void)setLayoutableToEdit:(id)layoutableToEdit -//{ -// if (_layoutableToEdit != layoutableToEdit) { -// _layoutableToEdit = layoutableToEdit; -// -//// [self enableInspectorNodesForLayoutable]; -//// [self updateInspectorWithLayoutable]; -// } -//} +- (void)setLayoutableToEdit:(id)layoutableToEdit +{ + if (_layoutableToEdit != layoutableToEdit) { + _layoutableToEdit = layoutableToEdit; + +// [self enableInspectorNodesForLayoutable]; +// [self updateInspectorWithLayoutable]; + } + [_tableNode.view reloadData]; +} #pragma mark - ASTableDataSource - (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath { - return [[ASLayoutableInspectorCell alloc] initWithProperty:(ASLayoutablePropertyType)indexPath.row layoutableToEdit:self.layoutableToEdit]; + return [[ASLayoutableInspectorCell alloc] initWithProperty:(ASLayoutablePropertyType)indexPath.row layoutableToEdit:_layoutableToEdit]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section diff --git a/AsyncDisplayKit/Details/_ASDisplayView.mm b/AsyncDisplayKit/Details/_ASDisplayView.mm index 22477a04..fca8c44d 100644 --- a/AsyncDisplayKit/Details/_ASDisplayView.mm +++ b/AsyncDisplayKit/Details/_ASDisplayView.mm @@ -90,6 +90,9 @@ self.keepalive_node = _node; } else if (currentSuperview && !newSuperview) { + if (_node.inHierarchy) { //FIXME: remove or rebase + [_node __exitHierarchy]; + } self.keepalive_node = nil; } diff --git a/examples/ASLayoutSpecPlayground/Sample/AppDelegate.m b/examples/ASLayoutSpecPlayground/Sample/AppDelegate.m index cb76ab2b..b28cdcb1 100644 --- a/examples/ASLayoutSpecPlayground/Sample/AppDelegate.m +++ b/examples/ASLayoutSpecPlayground/Sample/AppDelegate.m @@ -32,7 +32,7 @@ UISplitViewController *splitVC = [[UISplitViewController alloc] init]; splitVC.viewControllers = @[masterNav, detailNav]; splitVC.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible; - splitVC.maximumPrimaryColumnWidth = 200; + splitVC.maximumPrimaryColumnWidth = 250; rootVC = splitVC;