mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-06 04:32:06 +00:00
* Objective-c project updated to ASDK 2.0 * fix assets error * [LayoutSpecExamples] Renamed new example project to be easier to type / find. * [Bulid] Manually create Sample.xcscheme file to hopefully fix complaining bulid :). * clean up project * commentary on ASAbsoluteLayoutSpec * address @maicki's comments
54 lines
2.0 KiB
Objective-C
54 lines
2.0 KiB
Objective-C
//
|
|
// OverviewCellNode.m
|
|
// Sample
|
|
//
|
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
|
|
#import "OverviewCellNode.h"
|
|
#import "LayoutExampleNodes.h"
|
|
#import "Utilities.h"
|
|
|
|
@interface OverviewCellNode ()
|
|
@property (nonatomic, strong) ASTextNode *titleNode;
|
|
@property (nonatomic, strong) ASTextNode *descriptionNode;
|
|
@end
|
|
|
|
@implementation OverviewCellNode
|
|
|
|
- (instancetype)initWithLayoutExampleClass:(Class)layoutExampleClass
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
self.automaticallyManagesSubnodes = YES;
|
|
|
|
_layoutExampleClass = layoutExampleClass;
|
|
|
|
_titleNode = [[ASTextNode alloc] init];
|
|
_titleNode.attributedText = [NSAttributedString attributedStringWithString:[layoutExampleClass title]
|
|
fontSize:16
|
|
color:[UIColor blackColor]];
|
|
|
|
_descriptionNode = [[ASTextNode alloc] init];
|
|
_descriptionNode.attributedText = [NSAttributedString attributedStringWithString:[layoutExampleClass descriptionTitle]
|
|
fontSize:12
|
|
color:[UIColor lightGrayColor]];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
|
|
{
|
|
ASStackLayoutSpec *verticalStackSpec = [ASStackLayoutSpec verticalStackLayoutSpec];
|
|
verticalStackSpec.alignItems = ASStackLayoutAlignItemsStart;
|
|
verticalStackSpec.spacing = 5.0;
|
|
verticalStackSpec.children = @[self.titleNode, self.descriptionNode];
|
|
|
|
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 16, 10, 10) child:verticalStackSpec];
|
|
}
|
|
|
|
@end
|