mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00

git-subtree-dir: submodules/AsyncDisplayKit git-subtree-mainline: d06f423e0ed3df1fed9bd10d79ee312a9179b632 git-subtree-split: 02bedc12816e251ad71777f9d2578329b6d2bef6
41 lines
1.2 KiB
Swift
41 lines
1.2 KiB
Swift
//
|
|
// PhotoWithOutsetIconOverlay.swift
|
|
// Texture
|
|
//
|
|
// Copyright (c) Pinterest, Inc. All rights reserved.
|
|
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
import AsyncDisplayKit
|
|
|
|
fileprivate let userImageHeight = 60
|
|
|
|
public class PhotoWithOutsetIconOverlay: ASDisplayNode, ASPlayground {
|
|
public let photoNode = ASNetworkImageNode()
|
|
public let iconNode = ASNetworkImageNode()
|
|
|
|
override public init() {
|
|
super.init()
|
|
backgroundColor = .white
|
|
|
|
automaticallyManagesSubnodes = true
|
|
setupNodes()
|
|
}
|
|
|
|
private func setupNodes() {
|
|
photoNode.url = URL(string: "http://asyncdisplaykit.org/static/images/layout-examples-photo-with-outset-icon-overlay-photo.png")
|
|
photoNode.backgroundColor = .black
|
|
|
|
iconNode.url = URL(string: "http://asyncdisplaykit.org/static/images/layout-examples-photo-with-outset-icon-overlay-icon.png")
|
|
iconNode.imageModificationBlock = ASImageNodeRoundBorderModificationBlock(10, .white)
|
|
}
|
|
|
|
// This is used to expose this function for overriding in extensions
|
|
override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
|
|
return ASLayoutSpec()
|
|
}
|
|
|
|
public func show() {
|
|
display(inRect: CGRect(x: 0, y: 0, width: 190, height: 190))
|
|
}
|
|
}
|