I’ve been trying to make a chess game using UITable, and one of the features I’m trying to implement is the pieces (in the table) having the right colors. However, when I change the title color for them, they remain blue. Is this an iOS limitation or am I doing something wrong?
async function renderBoard(board,selectedPiece=null){
let white=Color.white()
let black=Color.black()
let red=Color.red()
let shownTable=new UITable()
let rowArray=new Array(8)
let tableArray=Array.from(rowArray, (()=>rowArray))
if (!selectedPiece){
let rowCount=7
for (let i of board.grid){
let colCount=0
let row=new UITableRow()
for (let j of i){
if (!j){
tableArray[rowCount][colCount]=((row.addText("-")).titleColor=Color.gray())
}else{
let cell=UITableCell.button(j.name)
cell.titleColor={"w":white,"b":black}[j.color]
cell.dismissOnTap=true
cell.onTap = () => {currentPiece=j}
row.addCell(cell)
tableArray[rowCount][colCount]=cell
}
}
shownTable.addRow(row)
rowCount--
}
}else{
let rowCount=7
for (let i of board.grid){
let colCount=0
let row=new UITableRow()
for (let j of i){
if (!j){
tableArray[rowCount][colCount]=((row.addText("-")).titleColor=Color.gray())
}else{
let cell=UITableCell.button(j.name)
cell.titleColor={"w":white,"b":black}[j.color]
cell.dismissOnTap=true
cell.onTap = () => {currentPiece=j}
row.addCell(cell)
tableArray[rowCount][colCount]=cell
}
}
shownTable.addRow(row)
rowCount--
}
}
return shownTable
}
