如何生成10×10矩阵15个字

时间:2011-11-17 09:16:41

标签: iphone

我正在制作单词搜索益智游戏.. 我希望以10 * 10矩阵形式生成大约15个单词。 每个方面都是UIButton。 在每个按钮上都会有单词的字符。

单词应垂直,水平,交叉排列。

如何生成此特定矩阵..?

任何人都可以分享我的想法或代码等。

谢谢, Keyur Prajapati

1 个答案:

答案 0 :(得分:1)

Rather than button use uiimageview, it will be easy as u can implement the sliding effect as well.
U need to implement different classes as Matrix, Plate, Coordinate, BoardManager. Now you have implement the logic arround this class. 
.h matrix class 
int row; int column; NSMutableArray *matrix;

.h plate class
Coordinate *currentCordinate; //center coordinate of the plate.
int presentRow; int presentCol;

.h BoardManager
NSInteger boardMatrixRow;  NSInteger boardMatrixColumn;

.h Coordinate
CGFloat x; CGFloat y;

Now implement the methods and apply your logic of inserting the object into matrix array,assign the coordinates to the plates/image, tagging the image.

As such no tutorial encountered.