简体   繁体   English

iOS-绘制数千个符号的最佳方法

[英]iOS - The best way to draw thousands of symbols

What is the best way to display thousands or even more dynamic symbols (like Matrix's rain) ? 显示数千个甚至更多动态符号(如Matrix的大雨)的最佳方法是什么? I tried to do that in drawRect method by 我试图在drawRect方法中做到这一点

for (NSString *symbol in self.symbols) {
        [symbol drawAtPoint:CGPointMake(posX, posY) 
             withAttributes:@{NSFontAttributeName : self.font, 
                              NSForegroundColorAttributeName : color}];
    }

But much smaller the font, so much more laggy it becomes. 但是,字体要小得多,所以会变得更加滞后。
eg when font pointSize is 10, then CPU percentage is 98%. 例如,当字体pointSize为10时,则CPU百分比为98%。

So what is the best way to show a lot of symbols and redraw them every milliseconds from performance side ? 那么,显示许多符号并每毫秒从性能方面重新绘制它们的最佳方法是什么?

对于像这样的图形密集型过程,您将需要使用OpenGL或可能使用SpriteKit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM