简体   繁体   English

在IOS上绘制彩色网格的最快方法是什么?

[英]Whats the fastest way to a draw grid of color on IOS?

Im trying to continually update a grid of colors on my iPhone screen ( testing with 50x50, but would like to scale up later ) I have done some research but can't seem to find an agreed upon solution. 我试图不断更新iPhone屏幕上的颜色网格(使用50x50进行测试,但希望以后进行扩展)我已经进行了一些研究,但似乎找不到商定的解决方案。 I've tested CAShapes and UIBezier paths and colored UIViews, but everything is slow. 我已经测试了CAShapes和UIBezier路径以及彩色的UIView,但是一切都很缓慢。 Is there another option besides diving into OpenGL or Metal? 除了深入研究OpenGL或Metal,还有其他选择吗? Doesn't need to be crazy fast, just faster than the before-mentioned options. 不需要快疯了,只需要比前面提到的选项快。 Thanks, I'm working in Objective-C 谢谢,我在Objective-C工作

If you don't want to dive into Metal then what I found much quicker for an app I wrote years ago was to put my data into a byte array and then use that array to render a bitmap image. 如果您不想涉足Metal,那么我发现我几年前编写的应用程序要快得多,那就是将数据放入字节数组,然后使用该数组渲染位图图像。

I don't have all the details now. 我现在没有全部细节。 It used something like an “image provider” and various other parts. 它使用了诸如“图像提供程序”之类的东西以及其他各个部分。 But it was much quicker than any other method I tried. 但这比我尝试过的任何其他方法都快得多。

I was able to draw over 5000 “pixels” per frame using it so it should be good For you now. 我能够使用它在每帧上绘制5000多个“像素”,因此现在对您来说应该是不错的选择。

Then you can either draw it into a view in drawRect or put it into a UIImageView. 然后,您可以将其绘制到drawRect的视图中,也可以将其放入UIImageView。

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

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