I use CALayer and CATextLayers to lay out the sudoku numbers on the iPhone.
I have a tableView that lists some sudokus. When I click one cell of the table, it shows sudoku in another viewController, which is clicked on the navigation controller.
In my method - (void)viewWillAppear ... I call my method - (void)loadSudoku , which I will show you below.
The problem is that when you look at one sudoku, return to the table view using the back button in the navigation bar, and then click another sudoku. Then the old sudoku still exists, and the new one on top of the old one.
I think I need to clean the old one somehow. Any ideas? I have a background image set via the constructor of a real sudoku grid interface. I do not want to delete this.
The method that draws sudoku is as follows:
- (void)loadSudoku { mainLayer = [[self view] layer]; [mainLayer setRasterizationScale:[[UIScreen mainScreen] scale]]; int col=0; int row=0; for(NSNumber *nr in [[self sudoku] sudoku]) { if([nr intValue] != 0) {
Linus source share