3

I just wanted to know how you could implement a bookcase, like in iBooks, into your iPhone app.

I presume you would need to use a UIScrollView, but then I read somewhere that you need to use a UITableView. Which is it?!

jscs
  • 63,694
  • 13
  • 151
  • 195
max_
  • 24,076
  • 39
  • 122
  • 211

3 Answers3

4

You'd use code that others have already written, such as AQGridView.

Dave DeLong
  • 242,470
  • 58
  • 448
  • 498
2

I'm not sure if there's a better way, but you could create multiple small views or images (these would represent each book) then add these small views/images to the subview of a larger view in a linear format (leaving a space between each element). Then just set the background of your larger view as an image of a bookcase. Sorry I don't know of a better way.

And for the above solution I would use a UIScrollView.

  • I think I may have misunderstood you, but from what you said above, i need to create separate UIViews with the images inside it (UIImageView) and then add them to a bigger horizontal UIView which would be the whole row, and leave space between each of the UIImageViews. Then I would need to duplicate the process for each row? – max_ May 14 '11 at 22:58
  • Yes that's what I was thinking. However it maybe a good idea to look into the suggestion given by @Dave DeLong too as this is the first time I've heard of it and it looks quite useful. –  May 15 '11 at 09:33
0

You can implement it anyway you like, but it seems to me that a UITableView would be the easiest (which will scroll anyway). All of the magic will happen in your UITableViewDataSource, which is where you will decide what books are placed on what row.

Once you have decided which books to display you will have create a custom tableview cell that draws the appropriate objects.

To be honest, while not too difficult of a task, it will take a lot of effort to get looking right. If you are not comfortable with custom drawing then be prepared to spend time learning about the various image/graphic APIs.

sosborn
  • 14,676
  • 2
  • 42
  • 46