在PHP中我會做這樣的事情:如何創建一個方法,像我一樣在PHP,但在Objective-C
function changeBgColor($boxColor,$color)
{
echo '<div id="'. $boxColor .'">'. $color .'</div>';
}
changeBgColor("box1","red");
但我還沒有找到一種方法,在Objective-C
做到這一點我想在Objective-C中寫出一些代碼,並且能夠調用一個方法來執行該代碼。
例如執行此代碼。但我想改變boxColor和redColor當我打電話的方法
boxColor.backgroundColor = [UIColor redColor];
感謝您幫助我更好地理解這一點。 – Syntax