Swiftgram/docs/_docs/text-cell-node.md

1.8 KiB
Executable File

title layout permalink prevPage nextPage
ASTextCellNode docs /docs/text-cell-node.html cell-node.html control-node.html

ASTextCellNode is a simple ASCellNode subclass you can use when all you need is a cell with styled text.

SwiftObjective-C
ASTextCellNode *textCell = [[ASTextCellNode alloc]
            initWithAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"SomeFont" size:16.0]} 												  insets:UIEdgeInsetsMake(8, 16, 8, 16)];
  
let textCellNode = ASTextCellNode(attributes: [NSFontAttributeName: UIFont(name: "SomeFont", size: 16.0)], 
                        		      insets: UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16))

The text can be configured on initialization or after the fact.

SwiftObjective-C
ASTextCellNode *textCell = [[ASTextCellNode alloc] init];

textCellNode.text = @"Some dang ol' text"; textCellNode.attributes = @{NSFontAttributeName: [UIFont fontWithName:@"SomeFont" size:16.0]}; textCellNode.insets = UIEdgeInsetsMake(8, 16, 8, 16);

let textCellNode = ASTextCellNode()

textCellNode.text         = "Some dang ol' text"
textCellNode.attributes   = [NSFontAttributeName: UIFont(name: "SomeFont", size: 16.0)]
textCellNode.insets       = UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)