开发者

How to create a grid like UI with xcode 4

I just wanted to ask a question about iPhone development using Apple's XCode. I am new to this but have a background in web development.

What I want is to create a grid kind of like a checkers board about 10 x 10 squares. And then when a user clicks on of those squares i will need to identify it with when they then click the submit turn button.

What would be the best way to go about creating a grid?

I had looked at the table control but it appears that doesn't support rows with multiple columns, tho I could be wrong, let me know if I am.

I also have considered using a UIWebView and just drawing out a table with HTML, but I'm not sure how I could track clicks on the grid.

I'm just after some advice to help me get going d开发者_开发技巧own the right route.


You can map the touch position in a single UIView to a square. You know the width of the view, you know the height of the view, so a tiny bit of math could do it.

The UITouch class provides a locationInView: method to give you the coordinates of the touch.


I think the easiest way to accomplish what you're after is to simply use UIButtons. Align them as a grid and when the user clicks on one you store which one he/she clicked in a variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜