开发者

Is there a faster way of doing this?

For a little practise fun project I did this:

I added a grid of UIView instances to an v开发者_Go百科iew controllers view which work pretty much like an number segment LCD (but those LCD screens that have squares and can show pretty much anything, not just numbers...with low resolution though).

There are 8 * 8 views on the screen (so 64 views, in total). A controller object is able to set the color of every view, to show a certain number. I've programmed already the "matrix" for the number 8.

I'd like to add some kind of noise effect like an broken TV with no reception. When there is no number to show, then all those 64 views must flash wildly with all kinds of rainbow colors, as fast as possible.

My for loop that goes over all those views and sets the backgroundColor can only do like 5 to 10 times per second. The screen doesn't update fast enough and it doesn't look really like TV noise.

Would it be a lot faster when I would implement this matrix in OpenGL ES and then show this OpenGL ES view instead? How hard is it to make a matrix of addressable squares in OpenGL ES?


Updating 64 UIViews at a high frequency is going to be difficult. I'd suggest using one UIView and creating 64 CALayers inside that view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜