开发者

Laggy UIScrollView

开发者 https://www.devze.com 2023-04-01 14:34 出处:网络
At the moment I\'m working on an iPad expl开发者_高级运维ore game which has a hexagon tile map.

At the moment I'm working on an iPad expl开发者_高级运维ore game which has a hexagon tile map.

I've created a UIScrollView that contains a background view (the game map) and buttons in the form of hexagons (for interaction). I add every UIButton to the view via addSubview.

But... when I add more than 100 buttons the view gets laggy (no surprise here). But what should I do to solve this?

Example:

scroll view http://img233.imageshack.us/img233/5527/screenshot2011090110353.png


Adding UIButtons isn't the way to go here. You should probably draw the "buttons" in a custom -drawRect: method and use -touchesEnded:withEvent: to decide what the user wanted to do.

0

精彩评论

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