Mario García
Mario García

Reputation: 53

How to build a NxN Boggle game board in Cocoa

Recently, I built a web based Boggle solver which looks like this:

enter image description here

The UI let's the user select a grid size, enter the letters and display the board.

As a programming exercise, I want to build a Mac native app using Cocoa that does the same thing. I am a bit rusty on AppKit, and I need some advice on what layout elements I can use to build the NxN board. I checked the documentation, and it looks like NSMatrix might be what I need, but it is deprecated and it's use is discouraged. I would also like each cell in the board to be a TextField where the user can type a letter directly.

Thanks in advance!

Upvotes: 0

Views: 61

Answers (1)

Guilherme Rambo
Guilherme Rambo

Reputation: 2046

To create a grid of elements that can be updated dynamically, your best choice would be NSCollectionView. Each cell in your collection view would have a NSTextField inside to be used as the label. To learn more about how to implement NSCollectionView check out Apple's documentation.

Upvotes: 1

Related Questions