mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Channel statistics improvements
This commit is contained in:
37
submodules/GraphUI/Sources/UILabel+Utils.swift
Normal file
37
submodules/GraphUI/Sources/UILabel+Utils.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// UILabel+Utils.swift
|
||||
// GraphTest
|
||||
//
|
||||
// Created by Andrei Salavei on 4/9/19.
|
||||
// Copyright © 2019 Andrei Salavei. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UILabel {
|
||||
func setTextColor(_ color: UIColor, animated: Bool) {
|
||||
if self.textColor != color {
|
||||
if animated {
|
||||
let animation = CATransition()
|
||||
animation.timingFunction = CAMediaTimingFunction.init(name: .linear)
|
||||
animation.type = .fade
|
||||
animation.duration = .defaultDuration
|
||||
self.layer.add(animation, forKey: "kCATransitionColorFade")
|
||||
}
|
||||
self.textColor = color
|
||||
}
|
||||
}
|
||||
|
||||
func setText(_ title: String?, animated: Bool) {
|
||||
if self.text != title {
|
||||
if animated {
|
||||
let animation = CATransition()
|
||||
animation.timingFunction = CAMediaTimingFunction.init(name: .linear)
|
||||
animation.type = .fade
|
||||
animation.duration = .defaultDuration
|
||||
self.layer.add(animation, forKey: "kCATransitionTextFade")
|
||||
}
|
||||
self.text = title
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user