mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-05-17 00:06:44 +08:00
51 lines
1.0 KiB
Objective-C
51 lines
1.0 KiB
Objective-C
//
|
|
// ColorNode.m
|
|
// ASLayoutSpecPlayground
|
|
//
|
|
// Created by Hannah Troisi on 3/11/16.
|
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
|
//
|
|
|
|
#import "ColorNode.h"
|
|
#import "ASLayoutableInspectorNode.h"
|
|
|
|
@implementation ColorNode
|
|
{
|
|
ASTextNode *_cellNumber;
|
|
ASButtonNode *_plusSignButton;
|
|
}
|
|
|
|
#pragma mark - Lifecycle
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
|
|
if (self) {
|
|
|
|
self.layer.borderWidth = 2;
|
|
self.layer.borderColor = [[UIColor blackColor] CGColor];
|
|
self.backgroundColor = [UIColor purpleColor];
|
|
self.alignSelf = ASStackLayoutAlignSelfEnd;
|
|
[self addTarget:self action:@selector(nodeWasTapped:) forControlEvents:ASControlNodeEventTouchUpInside];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
|
|
{
|
|
if (CGSizeEqualToSize(self.preferredFrameSize, CGSizeZero)) {
|
|
return CGSizeMake(50, 50);
|
|
} else {
|
|
return self.preferredFrameSize;
|
|
}
|
|
}
|
|
|
|
- (void)nodeWasTapped:(UIGestureRecognizer *)sender
|
|
{
|
|
[ASLayoutableInspectorNode sharedInstance].layoutableToEdit = self;
|
|
}
|
|
|
|
@end
|