【问题标题】:Mix CATextLayer and CAScrollLayer混合 CATextLayer 和 CAScrollLayer
【发布时间】:2014-05-16 02:18:29
【问题描述】:

我需要一个可滚动的 CATextLayer 来显示一个 NSAttributedString。 有什么方法可以混合两个图层,或者向 CATextLayer 添加滚动或在 CAScrollLayer 中显示文本?

对不起,如果问题不是很准确。 谢谢!

编辑:我还没有看到 CALayer 是可滚动的。 对不起!

【问题讨论】:

    标签: iphone objective-c ios catextlayer quartz-core


    【解决方案1】:

    尝试将此添加到您的示例中以编程方式滚动图层:

    - (void)scroll {
        [scrollLayer scrollToPoint:scrollPoint];
        scrollPoint.x += 10;
        [self performSelector:_cmd withObject:nil afterDelay:0.1];
    }
    

    并在初始化方法的末尾添加:

    scrollPoint = CGPointMake(0, 0);
    [self scroll];
    

    【讨论】:

      【解决方案2】:

      CALayer(和 CATextLayer)可以滚动

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-01-20
        • 2021-11-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-26
        • 1970-01-01
        相关资源
        最近更新 更多