0
votes

I've been working on a Crosswords app for a while and this problem keep returning no mater what i try.

The actual game runs in an UIScrollView because the player should be able to zoom, pan etc.

To the UIScrollview i have added a UIView. First i tried to add multiple UIImageViews and UILabels to the UIView but it resulted in very bad scrolling performance.

Now I've tried to create 3 subclassed UIViews where i wrote a custom drawRect method for each of them. I need 3 UIVIews because only two of the them needs to be redrawn, but not at the same time. The third one contains the clue numbers which are constant.

My UIScrollView hierarchy look like this:

UIScrollView
   UIView
      UIImageView (show the game board image)
      UIView (shows the marked row/column)
      UIView (shows the text the user writes)
      UIView (shows the clue numbers)

I think the problem is that i have the UIImageView + 3 UIViews in one UIView. When I try to make this hierarchy it doesn't lag, but I'm not able to zoom, pan, scroll etc.:

UIScrollView
   UIImageView (show the game board image)
   UIView (shows the marked row/column)
   UIView (shows the text the user writes)
   UIView (shows the clue numbers)

Can you please try do guide me in the right direction. I will appreciate if I do not have to change too much, because the code in the three UIVIews are pretty long.

Thanks in advance :)

EDIT

Screenshot: http://crosswords-plus.com/puzzles/screen.png

1

1 Answers

0
votes

First off, I'd recommend shrinking your UIScrollView and pulling the UIView containing the clues out of it. It sounds like it doesn't need to pan/zoom, so you're just adding to the overhead by having it contained inside the UIScrollView.

Secondly, it's hard to give much of an answer without seeing your implementation, but it seems to me that it's possible to turn the UIImageView/UIView/UIView hierarchy into 1 subclass that draws empty, blacked out or filled-in squares plus row/column numbering as necessary. That way, you only have 1 UIView in the UIScrollView and all of this is probably much simpler.

Is that helpful? Is there a reason you're using a UIImageView for the background? Is there a reason you're separating the row/column numbering from the text the user has entered?