ejazz
ejazz

Reputation: 2518

Laggy UIScrollView

At the moment I'm working on an iPad explore 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

Upvotes: 1

Views: 269

Answers (1)

Fabian Kreiser
Fabian Kreiser

Reputation: 8337

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.

Upvotes: 3

Related Questions