CATextLayer字体大小动画速度

时间:2017-03-28 09:01:59

标签: ios swift animation

我有一点恼人的问题。我有一个CATextLayer,我用它来显示UITextView的占位符。事实是,当动画这一层时,它的速度太小,我看到"跳跃"在动画期间。我使用带有velocity参数的UIView.animate,但它忽略了它。

GIF FILE:

DispatchQueue.main.async {
    UIView.animate(
        withDuration: 0.2,
        delay: 0.0,
        usingSpringWithDamping: 1.0,
        initialSpringVelocity: 1.0, // Ignore any options
        options: .curveEaseOut,
        animations: {
            self.floatingLabel?.fontSize = 10
            self.floatingLabel?.frame = self.toggledFloaterFrame
        })
}

可能是什么问题?

1 个答案:

答案 0 :(得分:-1)

fontSize属性的动画是不可能的。尝试使用transform将其缩小。

您可以CGAffineTransform(scaleX: scale, y: scale) scale 10/self.floatingLabel.fontSizeCGAffineTransform.identity使用public class FileCopy { public static void recursivelyCopyContent(final File folder) { for (final File fileEntry : folder.listFiles()) { if (fileEntry.isDirectory()) { recursivelyCopyContent(fileEntry); } else if (fileEntry.getName().substring(0, fileEntry.getName().lastIndexOf(".")).toLowerCase().equals(folder.getName().toLowerCase())) { // just pass the folder and the file to the method that will do the actual content copy copyContent(folder, fileEntry); } } } public static void copyContent(final File folder, final File fileName) { try { // get the byte[] content of the source file byte[] fileContent = Files.readAllBytes(fileName.toPath()); for (final File fileEntry : folder.listFiles()) { // only select files with a different absolute path than the source one if(fileEntry.isFile() && !fileEntry.getAbsolutePath().equals(fileName.getAbsolutePath())) { // append contents from source to destination file Files.write(fileEntry.toPath(), fileContent, StandardOpenOption.APPEND); } } }catch (IOException e) { e.getStackTrace(); } } public static void main(String[] args) { final File folder = new File("/path-of-directory/"); FileCopy.recursivelyCopyContent(folder); } } 返回完整尺寸。

相关问题