Jump to content
IGNORED

EricBall's Tech Projects - iOS programming - battling with UICollection


RSS Bot

Recommended Posts

In my game I want a level builder. Users will be able to create their own levels and send them to me for inclusion in a future release. The UI is fairly simple - a level grid in the top of the screen and the level tiles in the bottom of the screen. Select a tile then where you want it in the grid. The tiles are in a scrolling view like a photo gallery. The iOS UIKit SDk even provides an out-of-the box solution - the UICollectionView (+UICollectionViewFlowLayout). It's suppose to be easy; not quite drag & drop, but fairly close.

The problem is the size of the tiles. An iPhone 4s is 640x960 pixels (320x480 "points") while an iPad is 768x1024 or 1536x2048 pixels (both 768x1024 "points"). So if I make the tiles 64x64 "points" the tiles end up much smaller relative to the level grid (which is resized to the screen size). There's no option in Interface Builder to make the size of the cell (which stores the tile) relative to the screen size.

And 'cause I'm just learning, I don't 100% understand what I'm doing. So it's a lot of trial and error. Google searches have given me some info, and I think I can set the cell size for the layout, but I haven't found anything which says how to properly resize the cell contents (and my attempts so far have failed).

I'm thinking there are two probable causes - first is execution order. The collection view does some buffering and preloading and I think that may be occurring before I'm calculating the size of the cells. Second is Interface Builder creates some implicit code in my application which might be blocking my efforts. My current focus is on the execution order to see how early I can determine the size of the cells so I can use that value elsewhere in the code.

Or maybe I need to find some sample code for fully dynamically sized collection views and reuse that.



http://atariage.com/forums/blog/7/entry-13344-ios-programming-battling-with-uicollectionview/
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...